Computer Science, asked by rekhagarg13, 1 month ago

String a = "Programme"; System.out.println(a.substring(0,4).equals("pro"));​

Answers

Answered by jsky
1

Answer:

         String a = "Programme";

  System.out.println(a.substring(0,3).equals("Pro"));

Explanation:

You were getting 'false' as an output as the indexing was wrong as it checks the string from '1' index and also the method is case sensitive so it was checking for 'pro' while the string was "Programme' with a capital P

Similar questions