Skip to content
Advertisement

Online Compiler won’t run more than one class

I am using the online compiler “onlinegdp” to run java and I am unable to use multiple files in my programming. The exact same code works on eclipse so I am unsure where the problem is.

I don’t know enough about java to try anything other that Object myObject = newObject(); . So anything would be helpful.

This is what is in my worker class

JavaScript

This is the main class

JavaScript

I got this error
Main.java:14: error: cannot find symbol
Worker bob = new Worker ();
^
symbol: class Worker
location: class Main

Advertisement

Answer

I don’t know how onlinegdp – online compiler will save another class file & reference it. If they have functionality then you can try to add them in package & import that file using package.

It’s pain to see the folder/project structure on most of the online compiler. They are meant to run small snippet & not to run the whole project.

Below is the snippet you can run on onlinegdp without creating the different file.

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement