Most asked top Interview Questions and Answers & Online Test
Education platform for interview prep, online tests, tutorials, and live practice

Build skills with focused learning paths, mock tests, and interview-ready content.

WithoutBook brings subject-wise interview questions, online practice tests, tutorials, and comparison guides into one responsive learning workspace.

Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Without Book Ask Question

Question. Java outOfMemory exception in string.split

- Getting Java outOfMemory exception in string.split while reading each line for 60 MB file. Please suggest what need to be done?

Posted At Jul 12, 2014 Posted By Raman
Answer. You should try first is reduce the file to small enough that it works. That will allow you to appraise just how large a problem you have.

Just a general Java note: don't write
String s1 = new String(tokens[0]);
String s2 = new String(tokens[1]);

Just need to write:
String s1 = tokens[0];
String s2 = tokens[1];

or even just use tokens[0] directly instead of s1, since it's about as clear.
Posted At Jul 12, 2014 Posted By Arindam

Enter your Answer

Name
Email Address
Answer
Security Check
Solve this to continue: 2 + 8 = ?
Copyright © 2026, WithoutBook.