Menu
Topics Index
...
`

String starts and ends


If you need explanation Read this topic

If you need Answer Take test on this topic

String starts and ends
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("ith", 37) + ", ");
        System.out.println(str.subSequence(15, 24));
    }
}

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. true, true, true, true, students
E. 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.

Ans is c..starts with the true and ends with capabilitees true,ends with lities true and startswith ith,,37 false at lst 15,24 is student

Posted by Uday Kumar    2014-09-02 03:48:13


e.compilation error since import java.lang.*; is not presnt..

Posted by Asma Mujtaba Khan    2014-09-02 03:57:43


ans is C

Posted by Raju VarshnEy    2014-09-02 04:08:07


#Asma_khalil java.lang.* is default package by jdk

Posted by Raju VarshnEy    2014-09-02 04:09:03


C

Posted by Akshay Bansod    2014-09-02 04:20:58


# Raju VarshnEy... i kno dis..bt it was useles to gv corrct answr.coz uday hv alreafy gvn..so jst for fun i did dat

Posted by Asma Mujtaba Khan    2014-09-02 10:50:34


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

Posted by Merit Campus    2014-09-03 04:18:04


© meritcampus 2019

All Rights Reserved.

Open In App