Menu
Question Index
...

What will be the output of following program?

public class Substring1 {
    public static void main(String[] args) {
        String org = "This is my java program";
        String search = "is";
        String sub = org.substring(5, 7);
        boolean label = true;
        if (sub == search) {
            System.out.print(label);
        } else {
            System.out.print(!label);
        }
    }
}


true
false
Compilation Error
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