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 do you mean by jjs in java8?
How are java objects passed to a method and what are native methods?
What is variable declaration and definition?
What is the java virtual machine?
In which language java is written?
What is abstraction in java?
What is the meaning of course?
What is considered an anti pattern?
Why java applets are more useful for intranets as compared to internet?
Does a function need a return?
what is meant by HQL?
Can static methods be inherited?
What is the default execution method in java?
What is tcp ip in java?
Is vector synchronized in java?