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

Networking, which concept is used to connect the networking in java

which concept is used to connect the networking in java

Jzebra integration into open erp web client, JZEBRA Integration into (Open ...

JZEBRA Integration into (Open ERP) Web Client Local Spooling/Printing to Local Print Device on ERP Client side Project Description: JZEBRA Integration into Open ERP Web Clien

What are the sub categories of ai explain, What are the Sub categories of A...

What are the Sub categories of Artificial Intelligence? Briefly explain any two. 1. Robotics :  These are the machines that are computer programmed and perform work that was pr

What is constructor chaining, What is constructor chaining and how is it ac...

What is constructor chaining and how is it achieved in Java? A child object constructor always first requires to construct its parent (which in turn calls its parent constructo

Package in java? , It helps to resolve naming conflicts when different pack...

It helps to resolve naming conflicts when different packages have classes with the same names. This also helps you prepare files within your project. As define : java.io package

Constructors or destructors in java program, Consider the following Java de...

Consider the following Java definition of an integer list class. class IntegerList { private int[] list = new int[200]; private int size = 0; public boolean append(int value) {

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