Create your account

Already have an account? Login here

Note: By joining, you will receive periodic emails from Coursetro. You can unsubscribe from these emails.

Create account

7. Hello World Example

Getting Started with Java

Woah, wait a second..

This is a 100% free course, but we need you to first join or login to watch this video.

Alright, join or login here.

This video shows you how to write a "Hello World" program in Java. To print something on the screen using the console or terminal or command prompt, use the println() method. A method is basically a bunch of instructions grouped together with a common name either written by someone or by you that does something you may want to do again and again. For example, you may want to print something on the screen and everytime you want to do it, you don't want to work with input and output facilities of the system. The System.out.println() method does all the hard work for you so that you just write that one line and give ti any text you want in order to display it on the screen. println() adds a new line after printing your text. If you want to keep everything on the same line, use the print() method instead. Browse 'Live Templates' under IntelliJ settings or preferences to find the word 'sout'. Type this word in IntelliJ and press 'Return' or 'Enter' on your keyboard which acts like a shortcut to write System.out.println() for you. You can add as many System.out.println() statements as you want and they all type the text you specify. Anything you write between '{' and '}' of main() will be executed by your compiler. You finally put everything into a class which will be discussed in detail later in this series.

Course Cirriculum