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 I use % with real numbers?
what is meant by encapsulation?
How do you ensure that n threads can access n resources without deadlock?
describe method overloading
What are the main uses of this keyword?
What is meant by class and object in java?
What is a get method?
What is join () in java?
How many bits is a float?
explain autoboxing in java?
How will you add panel to a frame?
What is passing value java?
What is singleton class in java and how can we make a class singleton?
Explain abstract class in java?
What is difference between equals and hashcode method?