हिंदी

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

Advertisements
Advertisements

प्रश्न

Write a program for the following.

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

कोड लेखन
Advertisements

उत्तर

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
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 10: String Handling - Exercises [पृष्ठ २४८]

APPEARS IN

रुपा पंडित Computer Applications [English] Class 10 ICSE
अध्याय 10 String Handling
Exercises | Q 4. (a) | पृष्ठ २४८
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×