Home / Programming MCQs / JAVA MCQs / Question
J
Q. What is the result of compiling and running the following code?
public class Tester{ static int x = 4; int y = 9; public Tester(){ System.out.print(this.x); // line 1 printVariables(); } public static void printVariables(){ System.out.print(x); // line 2 System.out.print(y); // line 3 } public static void main(String... args) { // line 4 new Tester(); } }
static methods cannot make references to non-static variables.
You must be Logged in to update hint/solution
What will be the output of following Java code?
Garbage Collection is the process of reclaiming the runtime unused memory automatically.
What is the output of this program?
A message string is returned by which method of an Exception object?
Static fields belong to the class, not instances of the class
A _______ object cannot be modified after it is created.
------------------- is an example of container class
Find the value of A[1] after execution of the following program.
Discusssion
Login to discuss.