Menu
Topics Index
...
`

Venkatadri Express


If you need explanation Read this topic

If you need Answer Take test on this topic

Venkatadri Express
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(true, 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);
    }
}

A. Venkatadri-true
express-false
B. Venkatadri-true
express-true
C. Venkatadri-false
express-true
D. Compilation Error or Runtime Error
Topic: Java regionMatches() Method - String Comparison

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 a because characters didn't match for express..

Posted by Kiran Karrolla    2014-01-23 04:20:56


Answer B..as both regions match with data string

Posted by Jayachandra Gupta    2014-01-23 04:23:10


A answer. express and Express gives false

Posted by Prudviraj Regumani    2014-01-23 05:53:19


answer b true represents to ignore case

Posted by Navya Golla    2014-01-23 07:49:12


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

Posted by Merit Campus    2014-01-24 04:02:13


© meritcampus 2019

All Rights Reserved.

Open In App