< Language Tutorials

Compared to languages like Python or Scratch, Java has a more complex syntax. Here's the hello world program in Java:

public class Hello {

  public static void main(String[] args) {
    System.out.println("Hello World");
  }

}

And in Scratch:

when gf clicked
say [Hello World!]
stop [this script v]

What Is What in These 2?

We can say that

public class Hello {

  public static void main(String[] args) {

is for a similar purpose as

when gf clicked

, they are here to start the program. System.out.println("Hello World") and say[Hello World!] are the program. While stop [this script v] is being used to stop the program, a semicolon (;) is used right after the System.out.println("Hello World"), as well as some curly brackets for those that were added earlier.

Cookies help us deliver our services. By using our services, you agree to our use of cookies.