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

Netbeans, how can i create an E-exam application on netbeans

how can i create an E-exam application on netbeans

Programming Excercise, I have to Create a program that determine the shippi...

I have to Create a program that determine the shipping cost for an order based on he following chart: From To Price $0.00 $19.99 $2.95 $20.00 $49.99 $3.95

Functions of specific codes, Please can you write some codes and their func...

Please can you write some codes and their functions too. At least 10! Please

Project on image processing, Project Description: Computer vision and Im...

Project Description: Computer vision and Image processing project to extract book title Skills required: Java, C Programming

Explain the java.net package, Explain The java.net package Each package...

Explain The java.net package Each package describes a number of classes, interfaces, exceptions, and errors. For instance, the java.net package contains these, classes, interfa

Web application using javascript-xml and css, Journal of how you came to AU...

Journal of how you came to AUB Write a web application using JavaScript, XML and CSS that contains a journal of major events and places on your journey to Bond University. The

Describe general approaches to solve statelessness problem, Problem : (...

Problem : (a) One problem encountered when designing web applications is that HTTP is a "stateless" protocol. Describe two general approaches to solve the statelessness probl

Catch clause should be used to handle the exception, How does a try statem...

How does a try statement determine which catch clause should be used to handle the exception?

Develop an ehospital project, Develop an ehospital project Project Descr...

Develop an ehospital project Project Description: I am preparing ehopsital project.for the requires of hospital in that patient registration and billing module and stores mod

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