Give the output
String x1 = "concatination";
System.out.println(x1.indexOf(x1.charAt(9))+x1.lastIndexOf(x1.charAt(7)));
System.out.println(x1.replace('n','r').equals(x1.substring(7)));
Answers
Answered by
2
Output:
17
false
Explanation:
Given,
String x1 = "concatination";
I. x1.indexOf(x1.charAt(9)) + x1.lastIndexOf(x1.charAt(7))
x1.indexOf('t') + x1.lastIndexOf('n')
5 + 12
Hence, 17.
II. x1.replace('n','r').equals(x1.substring(7))
"corcatination".equals("concati")
Obviously, false.
Similar questions