Jump to content

Online Java Compiler Issue: Code Not Executing as Expected


Recommended Posts

I'm using an online Java compiler for my project, and I'm encountering unexpected behavior in the execution of my code. Here's a simplified snippet:

import java.util.ArrayList;

public class Main {
    public static void main(String[] args) {
        ArrayList<String> fruits = new ArrayList<>();

        for (String fruit : fruits) {

Despite the seemingly straightforward code, I'm not getting the expected output. What could be causing this issue with the online Java compiler, and how can I rectify it to ensure proper code execution and output?

Edited by Phi for All
commercial link removed by moderator
Link to comment
Share on other sites

  • 2 weeks later...

.. try using different Java online compiler.. ?


I tried this:


And it showed:

java -cp /tmp/gCdTYn4aQ5 Main

But this 66 is simply a lack of EOL....

After changing the code to:


all is fine..

java -cp /tmp/gCdTYn4aQ5 Main


ps. Report the problem to the developers who created the online compiler, along with a code snippet, and it will be fixed.


Edited by Sensei
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.