String concatenation and comparison, JAVA Programming

Assignment Help:

String concatenation and comparison

public class StringTest {

public static void main(String[] args) {

int i = 4;

int j = 5;

System.out.println ("Hello" + i); // will l print Hello4

System.out.println ( i + j) ; // will print 9

String s1 = new String ("pakistan");

String s2 = "pakistan";

if (s1 == s2) {

System.out.println("comparing string using == operator");

}

if (s1.equals( s2) ) {

System.out.println("comparing string using equal method");

}

}

}

On execution of the above program, following output will produce

 

873_string.png


Related Discussions:- String concatenation and comparison

Big m method, i''ve done an application that calculates simplex methods i n...

i''ve done an application that calculates simplex methods i need to add big m method can any one help me?

What does a simple spring application contain, These applications are like ...

These applications are like any Java application. They are made up of not many classes, each performing a particular purpose within the application. But these classes are configure

Explain about the interpreter in java, Machines should have Java interprete...

Machines should have Java interpreter for the Java byte code to get implemented. Linking is a very simple process and this feature helps while developing applications. Java compile

Why local variable is preferred over global variable, Why Local variable is...

Why Local variable is preferred over Global variable ? In my point of view Global variable has a few advantage along with Local variables is preferred because of the subsequent

Implement the main program with user interface, You can now implement the m...

You can now implement the main program with its user interface for this assignment in the class MovieBrowse. This will provide a simple, command-line, interactive interface to prov

Classes, what is the default modifiers for methods in interface

what is the default modifiers for methods in interface

Multithreading, write a java program implementing multithreading concept in...

write a java program implementing multithreading concept in hotel management

Multiple choices output and codes, codes and output on how to make multiple...

codes and output on how to make multiple choices quiz

Extended eucleadian algorithm, inplementation of extended eucleadian algor...

inplementation of extended eucleadian algorithm in some cases

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd