Java Syntax Error

Introduction

Errors detected by the compiler are called syntax errors or compile errors.

Syntax errors happened in code construction, such as

  • mistyping a keyword
  • omitting some necessary punctuation
  • using an opening brace without a corresponding closing brace
  • named variable with illegal character

Question

What is the output of the following code?


public class Main {
  public static main(String[] args) {
    System.out.println("Welcome to Java");
  }
}


Compile time error

Note

The keyword void is missing before main.




PreviousNext

Related