Menu
Question Index
...

What will be the output of the following program?

public class Movie {
    public static void main(String[] args) {
        String data = "Venkatadri Express";
        String name = "venkatadri";
        String train = "express";
        boolean nameStstus = data.regionMatches(0, name, 0, name.length());
        boolean trainStstus = data.regionMatches(true, data.length() - train.length(), train, 0, train.length());
        System.out.print(name + "-" + nameStstus + "\n" + train + "-" + trainStstus);
    }
}


venkatadri-false
express-true
venkatadri-true
express-true
venkatadri-false
express-false
Compilation Error or Runtime Error

Doubts

Problems

Topic: Java regionMatches() Method - String Comparison

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App