How do I concatenate two strings in Java?

前端 未结 23 3034
长情又很酷
长情又很酷 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 05:25

    In java concatenate symbol is "+". If you are trying to concatenate two or three strings while using jdbc then use this:

    String u = t1.getString();
    String v = t2.getString();
    String w = t3.getString();
    String X = u + "" + v + "" + w;
    st.setString(1, X);
    

    Here "" is used for space only.

提交回复
热议问题