Showing posts with label charAt(). Show all posts
Showing posts with label charAt(). Show all posts

Sunday, August 21, 2016

String in Java

Strings in Java

1. int n;
char chr;
String st1=”Rakesh Roshan”;
n=st1.indexOf(‘e’);
chr=st1.charAt(5);

what will be the value of n and chr?

2. int n;
String str1=”Rakesh”;
String str2=”Roshan”;
n=str1.compareTo(st2);

what will be the value of n ?