Given a sample code:
1 public class Test {
2 public static void main(String[] args) {
3 Boolean b1 = new Boolean(true);
4 String s1 = new String("abc");
5 String s2 = new String("abc");
6 Boolean b4 = new Boolean(b1);
7 System.out.print(b1.equals(b4) + " ");
8 System.out.print((s1 == s2) + " ");
9 System.out.print(b1 == b4);
}}
What will be the result of above code ?
(1) The program compilation fails because of line number 6.
(2) true false false
(3) false false true
(4) true true false
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.