Menu
Topics Index
...
`

StringFunctions1960


If you need explanation Read this topic

If you need Answer Take test on this topic

StringFunctions1960
What will be the output of the following program?
public class StartsAndEnd {

    public static void main(String a[]) {
        String str = "There are many students with great application skills, we want to identify them and show them themselves and their capabilities.";
        System.out.print(str.startsWith("The") + ", ");
        System.out.print(str.endsWith("capabilities.") + ", ");
        System.out.print(str.endsWith("lities.") + ", ");
        System.out.print(str.startsWith("plication", 37) + ", ");
        System.out.println(str.subSequence(15, 39));
    }
}

A. true, true, true, true, students with great appl
B. true, true, false, false, students with great appl
C. true, true, true, false, students
D. Compilation Error  or Runtime Error
Topic: Additional String Methods in Java

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.

answer is b as startswith function and endswith functions return boolean values.

Posted by Vijay Kumar    2014-06-24 03:44:47


Answer : A

Posted by Deepak Kumar Yadav    2014-06-24 03:47:16


ans A it starts with the and endswith capabilitites and also endswith lities so on

Posted by Abhishek Pollishetty    2014-06-24 03:56:40


ANS: A , the first FOUR methods in SOP returns true and the last SOP returns the string from the str according to given character postion(15 to 39).

Posted by Damu Surya    2014-06-24 04:48:10


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

Posted by Merit Campus    2014-06-25 04:07:20


© meritcampus 2019

All Rights Reserved.

Open In App