Question: QUESTION 1 5 public class Foo { 6 int x = 20; 7- public static void main(String[] args) { 8 Foo food = new Foo();
![20; 7- public static void main(String[] args) { 8 Foo food =](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f4fd60c7ea8_68066f4fd6062804.jpg)



QUESTION 1 5 public class Foo { 6 int x = 20; 7- public static void main(String[] args) { 8 Foo food = new Foo(); 9 System.out.println(food.x); 10 11 } 12 13 } Compile Time Error Runtime error because Foox is final. Prints 10 Prints 20 QUESTION 2 4. What will be the output of the below program? public class Test { public static void main(String[] args) { char c = 65; System.out.println("C = " + c); } } O Compile Time Error Prints " CA Runtime Error Prints = 65 5. What will be output of below program? public class Test { public void main(String[] args) { int x = 10*20-20; System.out.println(x); } } Runtime Error Prints 180 Prints Compile-time error QUESTION 4 12. What will be the output of below program? public class Test { public static void main(String[] args) { String x = "abc"; String y = "abc"; x.concat(y); System.out.print(x); } } abcabc abc Compiles Error null QUESTION 5 What will be the output of below program? public class Test { public static void main(String[] args) { String si = "abc"; String s2 = "abc"; System.out.println("s1 == s2 is:" + $1 == } } s2); 51 52 is true o tale true
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
