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 are different data types?
Is there any way to skip finally block of exception even if some exception occurs in the exception block?
Which are the two subclasses under exception class?
What is nextline method in java?
What is the basic difference between string and stringbuffer object?
Which collection is thread safe in java?
Explain the difference between hashmap and hashtable in java?
How to find the largest value from the given array.
What does percent mean in java?
What is the difference between double and float variables in java?
Can a constructor be protected?
What java ide should I use?
What is an eror in java?
Why call by value prevents parameter value change?
Explain about method local inner classes or local inner classes in java?