Java Basics
Basic program structure
package main.java;
public class MainClass {
public static void main (String [] args) {
// Your code goes here ...
}
}
- Anything you type to the right of "//" is a comment, and it will not be read as code.
Sample line of code (to display text)
System.out.println("Testing");
- Put lines of code in the program between the curly braces { } shown in the structure.
- Put a semicolon ";" at the end of every line of code.
- You can put spaces and blank lines between segments/lines code to make it more readable.
Challenge
Write a program that will display "Hello World".
Quiz
Completed