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; public Tester(){ System.out.print(this.x); // line 1 Tester(); } public static void Tester(){ // line 2 System.out.print(this.x); // line 3 } public static void main(String... args){ // line 4 new Tester(); } }
static methods can't invoke 'this'.
You must be Logged in to update hint/solution
What is the output for the below code ?
Which environment variable is used to set the java path?
What is the output of the below Java program that tries to overload a method "abs"?
Which of these keywords is used by a class to use an interface defined previously?.
A java program can be run in any computer running under any ________.
Which of these exceptions will be thrown if we use null reference for an arithmetic operation?
What is the output of Java code snippet with a Ternary operator or Conditional operator?
Which method is used in thread class to test if the current thread has been interrupted?
Discusssion
Login to discuss.