String variable may not have been initialized (error diects to line 34)

前端 未结 4 560
太阳男子
太阳男子 2021-01-26 00:59

I\'ve been trying to get the string initialize, but to no avail. I have tried all of the solutions I have come across and I am not sure whether it is because of my ineptness or

4条回答
  •  滥情空心
    2021-01-26 01:58

    If I understand your question at all, than keep in mind you can't do this in Java:

    String str = "here is some
        random text";
    

    What you can do is

    String str = "here is some " + 
        "random text";
    

    In other words - can't break a string at the end of the line, gotta close it and use a + sign.

提交回复
热议问题