Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

hello world
java

How to write "Hello World" in Java

Educative Answers Team

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

The first step to getting familiar with a new language is to write a simple “Hello World” program. To create a “Hello World” program in Java, just follow these simple steps:

  • Create a file (i.e., helloworld.java).
  • Make sure that the outer class is of the same name as the filename, ​without extension (i.e., helloworld).
  • Now write the main method for the helloworld class.
svg viewer

Code

In the code below, the same steps are followed for the Hello World program.

Remember, every program in Java consists of a main method with the same signature, ​i.e., public static void main(String []args).​

class HelloWorld {
public static void main( String []args ) {
System.out.println( "Hello World!" );
}
}

RELATED TAGS

hello world
java
Copyright ©2022 Educative, Inc. All rights reserved

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring