DEV Community

Cover image for Creating Hello World! In Java
Mafee7
Mafee7

Posted on

Creating Hello World! In Java

Creating Hello World! In Java

Steps:

1) Download & Install Java

2) Download & Install An Java IDE (Integrated Development Environment) (I Use Eclipse Ide)

3) Create Java Project

4) Use This Code:

class helloworld {
  public static void main(String[] args){
     System.out.println("Hello World!");
  }
}
Enter fullscreen mode Exit fullscreen mode

Explanation:

   class helloworld{
   }
Enter fullscreen mode Exit fullscreen mode

defines a class named helloworld

  public static void main(String[] args){
  }
Enter fullscreen mode Exit fullscreen mode

Main Java Code Goes Here.

   System.out.println("Hello World!");
Enter fullscreen mode Exit fullscreen mode

Prints "Hello World!" in java console.

Remember: Don't Forget To End

 System.out.println("Hello World!")
Enter fullscreen mode Exit fullscreen mode

with a semicolon (;) to prevent an error.

Here we go! we have a hello world project in java!

Top comments (2)

Collapse
 
thorstenhirsch profile image
Thorsten Hirsch

Really?! A beginner who tries to follow your tutorial might habe hundreds of questions like:

  • Where do I download Java?
  • What Java version do I need?
  • What's the difference between a JDK and a JRE?
  • What IDE should I download?
  • Why is MAFEE7 using Eclipse although it seems like it's 100 years old and everybody else uses IntelliJ IDEA?
  • What's the difference between all the IDE's?
  • Should I download an IDE that comes with Java included?
  • And if so - why did I install Java separately to the IDE?
  • If not - how do I configure my Java installation in the IDE?
  • Why is MAFEE7's helloworld class in lower case whilst class names should be upper case?
  • How can I compile the code?
  • How can I run the code?

You don't answer any of these. But the one thing you think is important is the semicolon at the end? Really?! 🤦‍♂️

Collapse
 
mafee6 profile image
Mafee7

Lol 😂 i was like 2 days into java at that time!
and i didnt follow many practices.
since then i have slowly shifted to intellij
not a tutorial of course