F How to check two string equal or not in JAVA? | CodeTheta

How to check two string equal or not in JAVA?

March 15, 2018

Code :
package demo;
import java.util.Scanner;
/*
 * @author www.CodeTheta.com
 */
public class Demo {
    public static void main(String[] args) {
    String UserString1,UserString2;
    System.out.println("Enter any string: ");
    Scanner in = new Scanner(System.in);
    UserString1 = in.next();
    UserString2 = in.next();
    if(UserString1.equals(UserString2)){
        System.out.println("Equal String");
    }
    else {
        System.out.println("Not Equal String");
    }   
    }   
}

Output :
Enter any string: 
www.codetheta.com
www.codetheta.com
Equal String

IDE Used To Test This Code : NetBeans IDE 8.2

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

1 comments:

execute successfully. thank you

Reply

Post a Comment

PRODUCTS

LISTS OF PRODUCTS

SERVICES

SKILLS
SOFTWARE DEVELOPMENT
WEBSITE DEVELOPMENT
WEB HOSTING
BULK SMS SERVICE
SEO SERVICE
ANDROID APPS
QR CODE / BARCODE
HARDWARE SERVICE
OUR WORK AREA