What will be the result of attempting to compile and run the following class?
public class TestClass{
public static void main(String args[ ] ){
int i, j, k;
i = j = k = 9;
System.out.println(i);
}
}
Select 2 options
A. The code will not compile because unlike in c++, operator '=' cannot be chained
i.e. a = b = c = d is invalid.
B. The code will not compile as 'j' is being used before getting initialized.
C. The code will compile correctly and will display '9' when run.
D. The code will not compile as 'j' and 'i' are being used before getting initialized.
E. All the variables will get a value of 9.
Which of the following statements will compile without any error?
Select 4 options
A. System.out.println("a"+'b'+63);
B. System.out.println("a"+63);
C. System.out.println('b'+new Integer(63));
D. String s = 'b'+63+"a";
E. String s = 63 + new Integer(10);
If you want to solve the questions together with the experts and understand the concepts better, please contact us using the contact form or WhatsApp numbers. Selected people get to do that without any additional charges.