how we can write the string concatenation program in java.
Answer Posted / 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 View All Answers
What is the largest data type in java?
State the main difference between c++ and java?
Why is boolean important?
Can we use return in constructor?
what do you understand by synchronization? : Java thread
What is jit compiler in java?
What is the benefit of inner classes in java?
What is console based application in java?
What is consumer in java?
Can substring create new object?
Define how destructors are defined in java?
Explain 5 features introduced in jdk 1.7?
Explain method overloading?
Why string is a class?
What is user defined exception in Java?