how we can write the string concatenation program in java.

Answers were Sorted based on User's Feedback



how we can write the string concatenation program in java...

Answer / kandavel

class conc
{
public static void main(String args[])
{
String a="kanda",b="Vel",c;
c=a+b;
System.out.println(" Concat String :"+c);
}}

//This program must save the file name is conc.java

Is This Answer Correct ?    17 Yes 0 No

how we can write the string concatenation program in java...

Answer / sreekanth

public class StringConcat{
public static void main(String args[]){
String str1="abc";
String str2="def";
String str3=str1.concat(str2);
System.out.println(str3);
}}

Is This Answer Correct ?    6 Yes 0 No

how we can write the string concatenation program in java...

Answer / ashwini kumar vatsa

In java first all the integer or float etc declared are
converted into string so when we write
System.out.println("the name is"+x);where x is any primitive
type then first x is converted into string then it
concatenates with the other string so for concatenations
with other string we must have +operator.
class xyz{
static int x;
public static void main(String args[]){
xyz yz=new xyz();
yz.x=10;
System.out.println("the output is"+x);//here concat done
}
}

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More Core Java Interview Questions

Does java support multiple inheritances?

0 Answers  


Why collection doesn’t extend cloneable and serializable interfaces?

0 Answers  


how to get the max salary and name of employee from arraylist without using the Comperator or even Comparable interface?

2 Answers  


Can a constructor be private and how are this() and super() method used with constructor?

0 Answers   Flextronics, Hexaware,


What is persistence ?

2 Answers  






How will you override default serialization mechanism in java

2 Answers  


Why bytecode is called bytecode?

0 Answers  


If you are given the name of the function at run time how will you invoke the function?

0 Answers   Adobe, Yahoo,


what is the difference between static block and static method

19 Answers   Huawei,


Which of the classes will have more memory allocated?

0 Answers  


What is the difference between Stream Reader and Stream Writer?

4 Answers  


Name some classes present in java.util.regex package.

0 Answers  


Categories