Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


hada
String Comparison
1 Answer(s)      6 years and 6 months ago
Posted in : Java Interview Questions


How to compare string in Java?


Advertisement
View Answers

May 7, 2008 at 7:06 PM


Hi friend,

import java.io.*;
import java.io.IOException;

public class StringExamp{
public static void main(String[] args) throws IOException{
BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the first string !");
String str = buff.readLine();
System.out.println("Enter the second string");
String str1 = buff.readLine();
if(str.equals(str1)){
System.out.println("Enter string is equal.");
}
else{
System.out.println("String is not equals.");
}

}
}




-----------------------------------------

read for more information,

http://www.roseindia.net/java/java-tips/data/strings/12stringcomparison.shtml




Related Tutorials/Questions & Answers:
java string comparison example
java string comparison example  how to use equals method in String Comparison?   package Compare; public class StringTest { public static void main(String [] args){ String str="Rose"; String str1
String Comparison - Java Interview Questions
String Comparison  How to compare string in Java?  Hi... static void main(String[] args) throws IOException{ BufferedReader buff = new... the first string !"); String str = buff.readLine(); System.out.println
Advertisements
String comparison example
.style1 { font-size: medium; } String comparison example:- There are many comparison operators for comparing strings like <, <... for each character in the string. In the Action script3, every comparison
Date comparison
Date comparison  Hi..i have developed an application in which i pop up a message by comparing the dates.the comparison is done by the current date and the date previously stored in the database.the database value is first
comparison with null - Framework
comparison with null  String value = txtfld.getText(); if (value == null) ----- failing step----control goes to else part { // some code } else { // some code } Here comparison is not done.   Hi
Comparison of corresponding rows in a DB
Comparison of corresponding rows in a DB  How to compare corressponding rows in a database using Java????? ex...!!! Thankin u
Date comparison in PHP - PHP
Date comparison in PHP  I am looking for a date comparison code in PHP that can compare the date in between two different date formate.. for example: 11/12/1999 and 11/12/2001 to 11.11.1888 00:00:00 any idea on how
Hibernate case sensitive comparison.
Hibernate case sensitive comparison.  How to check for case sensitive in Hibernate criteria?   package net.roseindia.main; import... CaseSensitiveComprision{ public static void main(String[] args
Comparison Operators
Comparison Operators Operator is used to perform operation on variable and values. Comparison Operators are used to compare two values. Given below the complete list of available comparison operator in PHP : OPERATOR NAME
Comparison date - JSP-Servlet
Comparison date  sir i need to display a new web page when system date is equal to given date.iit is like birthday.i am using tomact server.when birth date is reached,a new page should be displayed automatically saying happy
comparison with null - Framework
comparison with null  I am having one textfield, from which I am getting text using getText() method. Now I want to compare this value with null (i.e. to check whether the entered value is null or not) How should I check
Date Comparison
Date Comparison       In this section we are discussing the comparison of two dates... dates whether they are equal or not by using the equals() method, comparison
Comparison between the types of sorting in java
Comparison between the types of sorting in java  welcome all i wanna program in java compare between selection,insertion,bubble,merge,quick sort In terms of timer and put all types in frame and find the timer for example array
Mysql Date Comparison
Mysql Date Comparison       Mysql Date Comparison is used to return the date from a table on the basis of comparison between any two values of dates. Understand
SQL Server row comparison using two tables
SQL Server row comparison using two tables  insertion process are completed in table1.string comparison using table2 to table1 if any changes in these tables and then upadated
PHP Comparison Operator
Comparison Operator: It is another kind of operator supported by PHP... .e.g. if we compare "23" (string data type) and 23 (integer data type... because of the dissimilarity of data type. Another way of comparison could
STRING.....
STRING.....  plzz sent me d code for counting vowels in a string... gui programme
string
string   difference detween "public static void main (String[] args) " and "public static void main (String args[])" in java but it executes both... "String args[]" can mean a "string array called args which is an array
string
string  String helloString = new String(helloArray); System.out.println(helloString); i am unable to understand this. could u plz explain
string
string  a java program using string function to input any string... ArrangeStringAlphabetically { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.print("Enter string
String
String  how to add spaces with string functions.?   Hi... String addSpaceToRight(String s, int n) { return String.format("%1$-" + n + "s", s); } public static String addSpaceToLeft(String s, int n) { return
String
characters in string?   import java.util.*; class RemoveDuplicateCharatcersFromString { public static String removeDuplicates(String s... < s.length(); i++) { String st = s.substring(i, i + 1
String
String  write down the code of remove any character from a given string without using any string function   please give me the code of remove any given character from a given string without using function
string
string   just i want to a program in a short form to the given string in buffered reader for example input string: Suresh Chandra Gupta output: S. C...; public class StringTest { public static void main(String [] args
string
string  a java program to input a string and display the string...*; import java.io.*; public class FirstLetter{ public static String capitalizeFirstLetter( String str ) { final StringTokenizer st = new StringTokenizer( str
string
ExtractWords { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.print("Enter String: "); String st=input.nextLine(); String str[]=st.split(" "); for(int i=0
JPA CriteriaBuilder - How to use ?IN? comparison operator
JPA CriteriaBuilder - How to use ?IN? comparison operator  Can you please help me how to convert the following codes to using "in" operator... = query.getResultList(); The internal Query String is converted to below, so I don't get
String
String  how to print in between numbers if the question "String s = "1,2,3,4,5,6,8,-25"" out must be 1 2,3,4,5,6,7,8,9,10,upto25
String
String  How to Convert sunnapu gopal to Sunnapu Gopal in java using String
 

 

 

DMCA.com