Menu
Question Index
...

What will be the output of the following program?

public class RegionMatchOfString
{
    public static void main(String[] args)
    {
        String string1 = "Welcome to Merit Campus";
        String string2 = "I work with Merit Campus";

        boolean foundRegion = string1.regionMatches(10, string2, 11, 13);

        System.out.println("Region match found:- " +  (foundRegion ? "TRUE" : "FALSE"));
    }
}


Region match found:- TRUE
Region match found:- FALSE
Compilation Error because ternary operator in System.out.println(); is not closed with semi-colon(;)
Compilation Error for some other reason
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