1.

Q3 ) State the outputString 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)));​

Answer»

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)));



Discussion

No Comment Found