DOWNLOAD

Get our toolbar!

Saturday, 30 April 2011

// write a program in java to compare two strings whether equal or not.

CODE



import java.lang.*;
import java.io.*;
public class CompString{
public static void main(String[] args) throws IOException{
System.out.println("String equals or not example!");
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Please enter first string:");
String str1 = bf.readLine();
System.out.println("Please enter second string:");
String str2 = bf.readLine();
if (str1.equals(str2)){
System.out.println("The given string is equals");
}
else
{
System.out.println("The given string is not equals");
}
}
}

OUT[UT DISPLAY


0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More