Skip to content
Related Articles
Open in App
Not now

Related Articles

Java | Data Types | Question 1

Improve Article
Save Article
Like Article
  • Last Updated : 29 Oct, 2018
Improve Article
Save Article
Like Article




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

My Personal Notes arrow_drop_up
Like Article
Save Article
Related Articles

Start Your Coding Journey Now!