How do I concatenate two strings in Java?

前端 未结 23 3065
长情又很酷
长情又很酷 2020-11-22 04:47

I am trying to concatenate strings in Java. Why isn\'t this working?

public class StackOverflowTest {  
    public static void main(String args[]) {
                


        
23条回答
  •  醉话见心
    2020-11-22 04:58

    This should work

    public class StackOverflowTest
    {  
        public static void main(String args[])
        {
            int theNumber = 42;
            System.out.println("Your number is " + theNumber + "!");
        }
    }
    

提交回复
热议问题