Menu
Question Index
...

What will be the output of the following program?

public class Gujarat {
    public static void main(String[] args) {
        String name = "Narendra Modi";
        String start = "narendra";
        String end = "Modi";
        boolean startStatus = name.startsWith(start);
        boolean endStatus = name.endsWith(end);
        System.out.print(startStatus + " " + endStatus);
    }
}


false true
true true
false false
Compilation Error
Runtime Error

Doubts

Problems

Topic: Java String startsWith() And endsWith() Methods

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App