What Will Be The Output Of The Following Java Codep Pre #320
What will be the output of the following Java code?</p> <pre><code class="language-java" line="1"> class A { int i; int j; A() { i = 1; j = 2; } } class Output { public static void main(String args[]) { A obj1 = new A(); System.out.print(obj1.toString()); } }</code></pre>
This multiple choice question (MCQ) is related to the book/course gs gs128 Java. It can also be found in gs gs128 Java Inheritance - Object Class in Java - Quiz No.1.
What will be the output of the following Java code?
class A { int i; int j; A() { i = 1; j = 2; } } class Output { public static void main(String args[]) { A obj1 = new A(); System.out.print(obj1.toString()); } }
true
false
String associated with obj1
Compilation Error