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

Implementations of set interface?

0 Answers  


What is the difference between the font and fontmetrics classes in java programming?

0 Answers  


What isan abstract class and when do you use it?

1 Answers   Genpact,


Is there any way to skip finally block of exception even if some exception occurs in the exception block?

0 Answers  


What are 4 pillers of object orinted programming?

0 Answers  


Suppose there is a System A which gives some output. This output is used as input by system B. The rate at which System A produces is faster than the rate at which system B consumes it. How can you improve this?

1 Answers   RBS,


How do you write a conditional statement?

0 Answers  


How do you add an arraylist to an array in java?

0 Answers  


Which class is extended by all other classes?

4 Answers  


Explain about OOPS concepts and fundamentals.

0 Answers   Syntel, Visa,


Why singleton is not thread safe?

0 Answers  


How do you convert boolean to boolean?

0 Answers  


Categories