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
Can we sort a map in java?
Which data type is a class in java?
How many unicode characters are there?
What are the main features of java?
What are multiple inheritances? Is it supported by java?
Can list contain null in java?
Why java is a platform independent? Explain
What is method reference in java?
What is the difference between equals() and == in java?
How to avoid memory leak in java?
What is the buffer limit?
Do loops java?
Why do we use return statement?
Can a abstract class be declared final?
Give any two differences between C++ and java.