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

Implement design in the java programming language, Implement your design in...

Implement your design in the Java programming language. Your main program file must be called MIPSim.java. Your simulator should implement the MIPS instruction set with the rest

Explain about core java, Java is increasingly used for middleware applicati...

Java is increasingly used for middleware applications to communicate among Server and clients. Java has features like multithreading, portability and networking capabilities. Chang

Write down html or javascript code to declare array, Write down HTML or Jav...

Write down HTML or JavaScript code for the following requirements: Declare an Array along with the identifier SUBJECT having length 5. Assign subsequent values to the array par

What does the keyword "synchronize" mean in java, What does the keyword " s...

What does the keyword " synchronize " mean in java. What are the usage and disadvantages of synchronization?

Algorithm, #question)i) devising ii) validating and iii) tes...

#question)i) devising ii) validating and iii) testing of algorithms...

Want a script developer, I want a Script developer who will make script for...

I want a Script developer who will make script for me and if you can show good works there are bonuses too. Skills required are Facebook Marketing, Java, Javascript, PHP, and Sc

Package, how to write bank system

how to write bank system

What is a packet in the network environment, What is a packet within the ne...

What is a packet within the network environment? What kind of information does it contain? A packet is the shortest unit of data transmitted over a computer network. It's a mes

What is aop alliance, AOP Alliance is an open-source project whose goal is ...

AOP Alliance is an open-source project whose goal is to promote adoption of AOP and interoperability between different AOP implementations by describing a common set of interfaces

Program on object oriented technology, This assignment is intended to write...

This assignment is intended to write a simple program in Java and to use the concept of Object Oriented Technology. Open a project named "MyProject" in NetBean. Under this proje

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