B---> initialized as Int but assigned string,C &F --> cannot assign null as var looks for typed initialization, D --> var should be used as local or inside methods
A & E are correct.
B cannot compile because var a is initialized as integer and then a string value is assigned.
C cannot compile because var cannot be initialized to null.
D - Doesn't have main()
F - Variable x already defined in scope
A and E correct.
C D F all wrong cuz they're missing a "public static void main(String[] args)" method
B wrong cuz "var a = 10" means "a" is an "int". trying to assign a string to "a" on the next line is invalid.
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.
SrinivasJasti
2 weeks, 1 day agoSrinivasJasti
2 weeks, 1 day agoxplorerpj
6 months, 3 weeks agosupersquax
11 months, 2 weeks ago