vimwiki

Java basics

main method

Each Java program must have a main method. It’s the method that gonna be executed first.

Every main method must contains the parameters String[] args.

public class test {
  public static void main(String[] args) {
      System.out.println("hello" + args[0]);
  }
}

Class

Java is an object-oriented programming language, which means it consitst of classes and methods. (And no function, only methods attach to classes).

print

System.out.print("hello");

Comment

// single line

/* multi
  line */