Java Programming for Beginners: From Introduction To Your First Java Project

Java Syntax

Every line of code that runs in Java must be inside a class. The class name should always start with an uppercase first letter. In our example, we named the class Main.

Java is case-sensitive. MyClass and myclass would be treated as two completely different names.

 

Statements:

In a programming language, these programming instructions are called statements.

System.out.println(“Java is Awesome!”);

 

Java Outputs

There is also a print() method, which is similar to println().

Print Text:

System.out.print(“Hello World! “);

Print Numbers

System.out.println(3);

 

Java Comments

Comments can be used to explain Java code, and to make it more readable.

comments start with two forward slashes (//).

// This is a comment for ‘mathematical calculations inside the println()’

System.out.println(2+3);