Friday, January 8, 2016

How to create Java hello world program on Ubuntu


Alright, on previous article i just show you how to install java on ubuntu, next in this article i'm going to teach you how to create the most basic java program ever, the hello world program on ubuntu.

Most people start with hello world program when they first learn new programming language, so that's why we need to create hello world program.

Step by step how to create java hello world program on ubuntu

  • open command line (press CTRL + ALT + T) and then type the following command:

  • gedit HelloWorld.java

  • gedit will appear, copy paste code below into the gedit

  • public class HelloWorld {
    
        public static void main(String[] args) {
            // Prints "Hello, World" to the terminal window.
            System.out.println("Hello, World");
      	System.out.println("ubuntuhowtotips.blogspot.com is awesome blog !!");
        }
    
    }



  • save the file and then close gedit
  • compile the HelloWorld.java

  • javac HelloWorld.java

  • run the HelloWorld program

  • java HelloWorld

Congratulation you have just create your own first hello world program with java programming language on ubuntu operating system.

No comments:

Post a Comment