What will be the result of attempting to compile and run the following program?
public class Main{ public static void main (String args [] ){ String s = "hello"; StringBuilder sb = new StringBuilder ( "hello" ); sb.reverse (); // w w w . j a v a 2 s . c o m s.reverse (); if ( s == sb .toString () ) System.out.println ( "Equal" ); else System.out.println ( "Not Equal" ); } }
Select 1 option
Correct Option is : A
A. is correct. There is no reverse()
method in String class.