- Getting Started
- Architecture
- Account and Subscriptions
- Compiler Guide
- Release Notes
Java Compiler Guide
Our compiler expects a complete Java program with a public class Main entry point. If your code doesn't follow this structure, compilation will fail.
Why does this matter?
When you create a new room, the editor is pre-loaded with a Java template. However, during a collaborative session, the code may be edited or replaced entirely. If the public class Main wrapper is removed, the compiler won't know where to start and will throw an error.
Required template
Your code must be wrapped in a public class Main with a public static void main(String[] args) method. Here is the minimum structure:
public static void main ( String[] args )
{Common mistakes
- Missing
public class Main— Writing a standalone function likevoid solve()without wrapping it in the Main class will cause a compilation error. - Wrong class name — Using
public class Solutionorpublic class HelloWorldinstead ofpublic class Mainwill fail. The class name must beMain. - Missing
mainmethod — The class must containpublic static void main(String[] args)as the entry point.
Example: adding a helper method
If you need helper methods, define them inside the Main class:
static int add ( int a, int b )
{return a + b;
public static void main ( String[] args )
{System. out. println ( add ( 2, 3 ) );
