(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



Reach Us

SERVICES

  • ACADEMIC
  • ON-LINE PREPARATION
  • FOUNDATION & CRASH COURSES

CONTACT

B-54, Krishna Bhawan, Parag Narain Road, Near Butler Palace Colony Lucknow
Contact:+918081967119