# Java on-ramp - Fully defined Entrypoints

DevFeed: [Java on-ramp - Fully defined Entrypoints](<https://devfeed.tech/articles/java-on-ramp-fully-defined-entrypoints-22011.md>)

Original publisher: [Read original article](<http://blog.joda.org/2022/10/fully-defined-entrypoints.html>)

Author: Stephen Colebourne (noreply@blogger.com)

Published: 2022-10-06T11:18:00Z

Content type: opinion

Language: en

Sources: [Stephen Colebourne](<https://devfeed.tech/sources/stephen-colebourne.md>)

Topics: [Java](<https://devfeed.tech/topics/java.md>), [Code](<https://devfeed.tech/topics/code.md>), [openjdk](<https://devfeed.tech/topics/openjdk.md>)

Tags: [classes](<https://devfeed.tech/tags/classes.md>), [code](<https://devfeed.tech/tags/code.md>), [getting-started](<https://devfeed.tech/tags/getting-started.md>), [java](<https://devfeed.tech/tags/java.md>), [javaideas](<https://devfeed.tech/tags/javaideas.md>), [launch](<https://devfeed.tech/tags/launch.md>)

## AI overview

The article argues that Java should introduce a dedicated entrypoint class declaration to make starting programs easier for newcomers and more useful for developers generally. The proposal would provide simpler syntax that compiles to a class file with distinct rules, including inferred class names and top-level code.

## Source excerpt

How do you start a Java program? With a main method of course. But the ceremony around writing such a method is perhaps not the nicest for newcomers to Java. There has been a bit of dicussion recently about how the "on-ramp" for Java could be made easier. This is the original proposal. Here are follow ups - OpenJDK, Reddit, Hacker news. Starting point This is the classic Java Hello Word: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World"); } } Lots of stuff going on - public, class, a class name, void, arrays, a method, method call. And one of the weirdest things in Java - System.out - a public static field in lower case. Something that is pretty much never seen in normal Java code. (I still remember System.out.println being the most confusing part about getting started in Java 1.0 - why are there two dots and why isn't it out()?) The official proposal continues to discuss: A more tolerant launch protocol Unnamed classes Predefined static imports for the most critical methods and fields The ensuing discussion resulted in various suggestions. Having taken some time to reflect on the proposal and discussion, here is my contribution, which is that what is really needed is something more comprehensive. Entrypoints When a Java program starts some kind of class file needs to be run. It could be a normal class, but that isn't ideal as we don't really want static/instance variables, subclasses, parent interfaces, access control etc. One suggestion was for it to be a normal interface, but that isn't ideal as we don't want to mark the methods as default or allow abstract methods. I'd like to propose that what Java needs is a new kind of class declaration for entrypoints. I don't think this is overly radical. We already have two alternate class declarations - record and enum. They have alternate syntax that compiles to a class file without being explictly a class in source code. What we need here is a new kind - entrypoint - tha