Menu
Question Index
...

Write a program to check the given two strings are equals or not, with the help of equals method.

Input (String, String) Output (Boolean)
'java', new String('java') true
'HYDERABAD', 'HYDERABAD' true
'Java School', new String('JavaSchool') false
'MeritCampus', new String('MeritCampus') true
'Vijayawada', new String('VIJAYAWADA') false



class ComparingStringsWithEqualsMethod
{
    public static void main(String s[])
    {
        String firstString = "java";
        String secondString = new String(firstString);
        System.out.println("Both Strings are equals : " + areEquals(firstString, secondString));

    }


    public static boolean areEquals(String firstString, String secondString) {
    }

}

Doubts

Problems

Topic: Java String Comparison Methods - Equals and EqualsIgnoreCase

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App