hello world

So, like I promised in the previous post, I am going to explain the program “Hello World”. A simple Java program , using eclipse.

Let’s start.First you should know where and how to write it.To do so you need to : Open Eclipse , Go to File , Select New Java Project , enter the project name(any name you wish, it’s up to you).Then you will see at the left of your editor, the project you just created.Right click New , and then click Class , enter the name of the class you as you wish and you’re good to go.

Hello World program

public class hello{
public static void main(String[] args){
System.out.println("Hello World by Bit Life");
}
}

 

hello world

And that’s it.Now I provided a photo where I compiled this script. When you run the script, the console opens and outputs “Hello World by Bit Life”.

Now let’s explain all the program

  • public class hello – it’s the name of your class, all your programs are in fact classes , java is based on classes so the program should start with the name of the class you provided.
  • public static void main(String[] args) –  the main method, in order for a program to run and display the desired output you should invoke this method,it is standard.
  • System.out.println(“Hello World by Bit Life”); – if you want something to be displayed on the screen(console), this is the method which makes it possible.Furthermore,you can write anything you want inside the ” “

Congrats my friends , now you are able to write simple programs in Java. In the next post, I will write programs in Java so Stay tuned.Have a nice day.

17 COMMENTS

  1. Hi there! This post couldn’t be written any better! Reading through this post reminds me of my previous room mate! He always kept talking about this. I will forward this article to him. Pretty sure he will have a good read. Thank you for sharing!

  2. “Hey would you mind sharing which blog platform you’re working with? I’m going to start my own blog in the near future but I’m having a difficult time making a decision between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design seems different then most blogs and I’m looking for something completely unique. P.S My apologies for getting off-topic but I had to ask!”

LEAVE A REPLY

Please enter your comment!
Please enter your name here