Saved Bookmarks
| 1. |
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))); |
|
Answer» ONG>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)));
|
|