How many characters can I read with the readline () method in java?

I use the readLine() method to read text, but I do not know how much text this method can read. Example.

 String str = in.readLine(); 

how many texts can read and store on "str"?

+4
source share
5 answers

he will read as much as is available until he meets eol

0
source

Integer.MAX_VALUE , but you obviously should not often come across this limitation.

- and note that this is because Integer.MAX_VALUE is the maximum size for a Java string

+8
source

Until LINE BREAK , fluent. Exactly, see Matthew's Answer. Greetings.

+1
source

This mistake makes me think that there is no limit.

0
source

If you need to ask this question, you will have a much bigger problem. Why are the lines you read so long that you need to worry about it? This indicates a poor design upstream.

0
source

Source: https://habr.com/ru/post/1302337/


All Articles