fork download
  1. class StringConcatenate
  2. {
  3. public static void main(String[] args)
  4. {
  5. String myFirstName = "Jack";
  6. String blank = " ";
  7. String myLastName = "Vanderbilt";
  8. int myAge =35;
  9. String myHobby = "I like to play Badminton and Volleyball";
  10. String myCombinedString = "My name is " + myFirstName + blank + myLastName + " " +"and my age is " + myAge + "." + "" + myHobby + ".";
  11. System.out.println(myCombinedString);
  12.  
  13.  
  14. }
  15. }
Success #stdin #stdout 0.05s 27872KB
stdin
Standard input is empty
stdout
My name is Jack Vanderbilt and my age is 35.I like to play Badminton and Volleyball.