Home / Programming MCQs / JAVA MCQs / Question
J
Q. What will be the output for the below code ?
1. public class Test{ 2. int i=8; 3. int j=9; 4. public static void main(String[] args){ 5. add(); 6. } 7. public static void add(){ 8. int k = i+j; 9. System.out.println(k); 10. } 11. }
i and j are instance variable and attempting to access an instance variable from a static method. So Compilation fails.
You must be Logged in to update hint/solution
Which action tags are used in JSP for developing web application with JavaBean?
Which of this package is used for remote method invocation?
Which of these method of DatagramPacket is used to find port number?
Can you pass values to ENUM constructors in Java?
Which of these is not a correct statement?.
Which driver converts JDBC calls directly into the vendor-specific database protocol?
The concept of derived classes is involved in _________.
Which of the following is an immediate subclass of the Panel class?
________ method is used to find out that a thread is still running or no
Which of these access specifiers must be used for main() method?
Discusssion
Login to discuss.