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

How virtual communities are formed, How virtual communities are formed? How...

How virtual communities are formed? How these are different from other Communities? Give examples. Virtual Communities are interest-based communities. Members along with genera

What is preferred organizational structure for organization, What is the pr...

What is the preferred organizational structure for the organization? The Network Organization is becoming the preferred organizational structure.

I want multiplayer backgammon game, I want Multiplayer Backgammon Game P...

I want Multiplayer Backgammon Game Project Description: We want a multiplayer backgammon as short as well as long one. It should be free and on money also. The games fronted

What is actionform, An ActionForm is a JavaBean that extends org.apache.str...

An ActionForm is a JavaBean that extends org.apache.struts.action.ActionForm.  ActionForm handles the session state for web application and the ActionForm object is automatically p

#The ArrayList class java, i want a full program with test about the follow...

i want a full program with test about the following: linkedComputers: We will assume that a number of methods are required. These are specified below. String getComputerName() ret

Conversation to html, Conversation to HTML Project Description: We ha...

Conversation to HTML Project Description: We have inner pages to be transformed into html for travel domain. 1. Flight search page for one way and round trip 2. Bus res

Decision tree algorithm, how to give dataset to a decision tree which is wr...

how to give dataset to a decision tree which is written by java using weka software?

Explain the three benefits of access protection, Explain the Three Benefits...

Explain the Three Benefits of Access Protection ? Access protection has three major benefits: 1. It permits you to enforce constraints on an object's state. 2. It gives a si

Modify user profile class, Modify your UserProfile class to meet the follow...

Modify your UserProfile class to meet the following requirements: It must include a field called wall to store an ArrayList of wall posting objects. It must also provide

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