Common errors practice Flashcards

1
Q

what is wrong?

public class Driver{

public static void main (String[] args){

	System.out.println("Hello")

} }

ERROR:
1. ’;’ expected

A

The ; at the end of “System.out.println(“Hello”)” is missing

This error means that you forgot a semicolon in your code. If you look at the full error statement, it will tell you where in your code you should check within a few lines. Remember that all statements in Java must end in a semicolon and elements of Java like loops and conditionals are not considered statements.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is wrong?

public class Main
{
   public static void main(String[] args)
   {
      System.out.println(Ett enkelt javaprogram");
   }
}
A

A “ is missing in “System.out.println(Ett enkelt javaprogram”)”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly