Home » JAVA Programming » Strings » Question
  1. What is the output of this program?

    public class Result
    {
    public static void main(String args[])
    {
    String ch = "hello i love interview mania";
    boolean var0;
    var0 = ch.startsWith("hello");
    System.out.println(var0);
    }
    }
    1. Hello
    2. hello
    3. false
    4. true
    5. None of these
Correct Option: D

startsWith() method is case sensitive “hello” and “Hello” are treated differently, hence true is stored in var0.



Your comments will be displayed only after manual approval.