Menu
Topics Index
...
`

Narendra Modi


If you need explanation Read this topic

If you need Answer Take test on this topic

Narendra Modi
What will be the output of the following program?
public class Modi {
    public static void main(String[] args) {
        String name = "Narendra Modi";
        String start = "Narendra";
        String end = "Modi";
        boolean startStatus = name.startsWith(start, 0);
        boolean endStatus = name.endsWith(end);
        System.out.print(startStatus + " " + endStatus);
    }
}

A. false true
B. true true
C. false false
D. Compilation Error
E. Runtime Error
Topic: Java String startsWith() And endsWith() Methods

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

Ans is B as start and end matched it prints true true

Posted by Naga Sinst    2014-06-26 13:11:17


ans is A

Posted by Adithya Aleti    2014-06-26 13:26:22


b

Posted by Perisetla Kanaka Ravali    2014-06-26 13:48:05


ans is A

Posted by Shashi Kumar    2014-06-26 14:11:14


ans : C , the string is should not start with 0 and we declared endswith "end" it return false

Posted by Damu Surya    2014-06-26 14:47:41


B

Posted by Shri Nandhitha    2014-06-26 16:16:48


Congratulations Naga Sinst. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-06-27 04:20:27


© meritcampus 2019

All Rights Reserved.

Open In App