how we can write the string concatenation program in java.
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
What are the access modifiers in java?
What is the difference between Access Modifier and Access specifier?
Can we inherit a class with private constructor?
Can we override the overloaded method?
What is the range of a character variable?
What is the meaning of immutable regarding string?
What is numel matlab?
how can i cal servlet from jsp page?how can i pass variablesfrom the jsp that servlet can access?
Does hashset allow duplicates in java?
How many types of methods are there in java?
EDS (Electronic Data Systems India Pvt Ltd) at Chennai on 16-12-2006.
What is the purpose of final keyword and when to use it?