String error “constant string too long”

前端 未结 4 1022
隐瞒了意图╮
隐瞒了意图╮ 2021-02-08 06:29

There is a 100,000-character text that need to be displayed. If I put it into String object, I get an error \"constant string too long\". The same is with StringBuffer object.

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-08 06:58

    I think the length of constant strings in java is limited to 64K -- however, you could construct a string at run time that is bigger than 64K.

提交回复
热议问题