Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How many characters can read by using the readline() method in java?

I using readLine() method for reading the text, but i am not aware of how many text can read that method. Ex.

String str = in.readLine();

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

like image 698
Venkat Avatar asked Jan 22 '23 12:01

Venkat


2 Answers

Integer.MAX_VALUE, but you obviously should not be running into this limit very often.

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

like image 60
Matthew Flaschen Avatar answered Jan 25 '23 01:01

Matthew Flaschen


Till LINE BREAK, loosely speaking. For the exact, see Matthew's answer. Cheers.

like image 41
Adeel Ansari Avatar answered Jan 25 '23 01:01

Adeel Ansari