Java | Data Types | Question 1
class Main { Â Â public static void main(String args[]) { Â Â Â int t; Â Â Â System.out.println(t); } Â } |
(A) 0
(B) garbage value
(C) compiler error
(D) runtime error
Answer: (C)
Explanation: Unlike class members, local variables of methods must be assigned a value to before they are accessed, or it is a compile error.
Quiz of this Question
Please Login to comment...