Menu
Question Index
...

Write a program to check the given two strings are equals or not, with the help of equals operator ('==').

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



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

    }


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

}

Doubts

Problems

Topic: Java equals method vs == Operator

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App