Key Concepts

Review core concepts you need to learn to master this subject

Printing in Java

For printing in the Java programming language, we use System.out.println("Hello World!"). System is a class from the core library provided by Java. out is an object and println() is a method. "Hello World!" in this case, is the argument received by the method.

Single Line Comments in Java

In the Java programming language, single line comments are created with the // syntax.

Multiple line comments start with /* and end with */.

Comments are ignored by the compiler.

Comments are used to enhance the readability of the program for human readers.

Ending a Java Statement

In the Java programming language, all statements end with a semicolon ;. Spaces and newlines between statements are ignored.

Java Bytecode

In the Java Programming language, program files are compiled into Java bytecode. The JVM (Java Virtual Machine) runs and executes compiled classes. The compiled files are platform independent.

A Java Statement

In the Java programming language, a statement is a line of code ending with a semicolon that executes a task. Statements are separated with a semicolon.

For example:

System.out.println("Hello World");

Main Method in Java

In the Java programming language, every application must contain a main() method with the signature: public static void main(String[] args) {}

main() is invoked first when we execute a program, all other methods can be called from main() method.

The main() method accepts a single argument: an array of elements of type String.

Class in Java with main() Method.

Java programs must contain one class with a main() method. main() method is invoked first. All other methods can be invoked via main() method.

Class in Java Programming

In the Java programming language, a class is a blueprint for creating objects. Each program must contain at least one class whose name is same as of the program file. For example public class Bicycle {}. The file name would be

Hello World: Java
Lesson 1 of 1
  1. 1

    Welcome to the world of Java programming. Programming languages enable humans to write instructions that a computer can perform. With precise instructions, computers coordinate applications and sy…

  2. 2

    Java runs on different platforms, but programmers write it the same way. Let’s explore some rules for writing Java. In the last exercise, we saw the file Java files have a **….

  3. 3

    Writing code is an exciting process of instructing the computer to complete fantastic tasks. Code is also read by people, and we want our intentions to be clear to humans just like we want our in…

  4. 4

    As we saw with comments, reading code is just as important as writing code. We should write code that is easy for other people to read. Those people can be co-workers, friends, or even yourself! …

  5. 5

    Java is a compiled programming language, meaning the code we write in a .java file is transformed into byte code by a compiler before it is executed by the Java Virtual Machine on your comp…

  6. 6

    Compilation helped us catch an error. Now that we’ve corrected the file, let’s walk through a successful compilation. As a reminder, we can compile a .java file from the terminal with the comm…

  7. 7

    In this lesson, we’ve started writing our first programs in Java. We’ve also learned rules and guidelines for how to write Java programs: * Java programs have at least one class and one […] m…

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo