How long is the shortest possible Java program?
August 5, 2016
This site utilizes Google Analytics, Google AdSense, as well as participates in affiliate partnerships with various companies including Amazon. Please view the privacy policy for more details.
This is my answer to this question on Quora.
You can even do a little shorter than Garry Taylor’s solution, by giving main’s argument a shorter name:
The class doesn’t even need to be public, it can be default as well:
You can verify that it works by running this slightly longer Java program:
Leave a Reply
Thank you. Your comment will be visible after approval.
Your comment has been submitted, but their seems to be an error. Check your browser console for more details.