9:56 am - Wednesday December 19, 2018

Java Program for String Values and Check the Condtion

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044

/**

*@author :CandidJava.com

*@descriptions : This program explains using String Values and Check If, Else if Condition.

*/

class Condition {

public static void main(String args[]){

String s1 = new String("Monkey went up the hill.");

String s2 = new String("Monkey went up the hill.");

if ( s1.equals(s2))

{

System.out.println("The strings are the same.");

}

else

{

System.out.println("The strings are not the same.");

}

}

}

Output:

D:\ candidjava\code>javac Condition.java

D:\ candidjava\code>java Condition

The strings areĀ  the same.

Filed in: Z-A All Java Codes

No comments yet.

Leave a Reply