English

Write a program for the following. Input two strings and verify whether they are same or not.

Advertisements
Advertisements

Question

Write a program for the following.

Input two strings and verify whether they are same or not.

Code Writing
Advertisements

Solution

importjava.util.*;
class clTask
{
    void main()
    {
       String s1, s2;
       Scanner sc = new Scanner(System.in);
       System.out.println(" Enter 1st string: ");
       s1 = sc.nextLine();
       System.out.println( " Enter 2nd string : ");
       s2 = sc.nextLine();
       if(s1.equals(s2))
       {
          System.out.println("Equal ");
       }
       else
       {
          System.out.println("Not Equal ");
       }
    }
}
shaalaa.com
  Is there an error in this question or solution?
Chapter 10: String Handling - Exercises [Page 248]

APPEARS IN

Rupa Pandit Computer Applications [English] Class 10 ICSE
Chapter 10 String Handling
Exercises | Q 4. (a) | Page 248
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×