Java Spec 16 Definite Assignment
Each local variable ... must have a definitely assigned value when any access of its value occurs.
14.4.2 Scope of Local Variable Declarations
"causes a compile-time error because the initialization of x is within the scope of the declaration of x as a local variable, and the local x does not yet have a value and cannot be used."
The same result will be even without static declaration like :
class Scope {
public static void main(String[]) {
int myint = myint;
System.out.println(myint);
}
}
D local variable myint is not initialized , u can use int myint = this.myint to reference the class variable myint
upvoted 3 times
...
This section is not available anymore. Please use the main Exam Page.1z0-819 Exam Questions
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.
06d854e
9 months, 2 weeks agoASPushkin
10 months, 3 weeks agotmuralimanohar
1 year, 12 months agoStavok
2 years agoMukes877
2 years agoRP384
2 years, 4 months agoAnkit1010
2 years, 4 months agoTADIEWA
2 years, 6 months ago