Java - New Line Character Issue

后端 未结 4 865
半阙折子戏
半阙折子戏 2021-01-28 01:50

I have a code like,

String str = \" \" ; 

while(  cond ) {

  str = str + \"\\n\" ;

}

Now, I don\'t know why at the time of printing, the out

4条回答
  •  渐次进展
    2021-01-28 02:25

    Based on your sample, the only reason it would not show a new line character is that cond is never true and thus the while loop never runs...

提交回复
热议问题