Quantcast
Channel: Why do I get a java.lang.OutOfMemoryError: Java heap space error? - Stack Overflow
Browsing all 3 articles
Browse latest View live

Answer by Guido Simone for Why do I get a java.lang.OutOfMemoryError: Java...

You are using Scanner hasNext/next incorrectly. You should always precede each next() with a hasNext().In your code, you are calling next() in front of the while loop. Then you are using the return...

View Article


Answer by Kevin Rubin for Why do I get a java.lang.OutOfMemoryError: Java...

You're using peek() which doesn't actually remove the next character from the input, so it loops on and on. You need nextInt();

View Article

Why do I get a java.lang.OutOfMemoryError: Java heap space error?

I am learning stacks right now, I my code compiles find. When I run it, code will not print my debug println's and the errorException in thread "main" java.lang.OutOfMemoryError: Java heap spaceat...

View Article
Browsing all 3 articles
Browse latest View live