Static variables or class variables are shared among all instances of a class and can be accessed and modified without creating an instance of the class
static variables belong to a class, we can access them directly using the class name
we can access static fields using an object reference
Only with first system.out can answered, 2, 5 (y is static So his value is for class no for instance)
upvoted 1 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
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.
ASPushkin
3 months, 1 week agod7bb0b2
1 year ago