Menu
Question Index
...

What will be the output of following program?

public class SubString {
    public static void main(String args[]) {
        String Myname = "Venkata Durga Bhavani";
        String petname = "";
        petname = Myname.substring(0, (Myname.length() - 14));
        System.out.print(petname);
    }
}


Venkata
Venka
Venk
Venkat
Compilation Error or Runtime Error

Doubts

Problems

Topic: Java String substring() method - substring In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App