(vi) Write the output of the following String methods:
String x= "Galaxy ", y= "Games ";
(a) System.out.println (x.charAt(0)==y.charAt(0));
(b) System.out.println (x.compareTo(y));
Solution
(a) true
(b) ASCII Code for 'l' is 108 and ASCII Code for 'm' is 109
108-109 = -1