Sort: Rank

Java String Interview Question
If we have the following in a Java code: String s="abc"; String s2="abc"; Then what will be output of: System.out.println("s.equals(s 2)= "+s.equals(s2)); System.out.println("s==s2 = "+(s==s2)); The correct answer is: s.equals(s2) = true s==s2 = true The following answer is wrong. Because both liter...
2016-06-26, 11861👍, 2💬

💬 2011-01-25 FYIcenter.com: Hi Kevin, Thanks. Answer updated.

💬 2011-01-17 Kevin McLain: This answer is wrong! String literals are interned by the VM this both will print true

Binary value in Switch case
Is it possible to pass a binary value to 'case' of 'switch' statement?The control value which we are using to test is also binary. switch(binary value) { case 0000: System.out.println(" "); break; case 0001: System.out.println(" "); break; }
2014-02-20, 1444👍, 0💬

  Sort: Rank