Answer A..Even though c is null, greet is a static method. In Java, static methods belong to the class, not instances of the class, so they can be called on the class itself or on a null reference to the class.
c.greet() with empty argument
produce args = String[0]
loop is not executed
Main c = null;
c.greet();
The access to static members is allowed through instances of the class that defines them.
The value of the instance doesn't matter.
it could be null.
A is correct, if line 7 (<span> is not considered) because String ... args generate a empty string by default.so if you no send arguments is an empty array. foreach dont print anything
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
c47d39c
6 months, 1 week agocathDev
9 months, 4 weeks agoASPushkin
10 months, 1 week agod7bb0b2
1 year agoSamps
1 year, 1 month agoOmnisumem
1 year, 3 months agoStavok
1 year, 6 months ago