Computer Science, asked by harishankerverma286, 7 months ago

Q3 ) State the output
String s="COVID19 is a pandemic that hit the world in 2020";
System.out.println(s.endsWith(s.substring(9));
System.out.println(s.lastIndexOf(s.charAt(1));
System.out.println(s.substring(13,19).compareTo("pandemic'));
System.out.println(Integer.parseInt(s.charAt(6)));

Answers

Answered by madhavivinod10
0

Answer:

see Explanation:

Explanation:

True // Ending string is same compared to original string

1     // index of charcter at 1 is 1

-2   //2characters missing compared to pandemic

// for last print statement:

prog.java:11: error: incompatible types: char cannot be converted to String

System.out.println(Integer.parseInt(s.charAt(6)));

Similar questions