Skip to main content

Java For Python Programmers Edition 2

Section 9.2 Forgetting a Semicolon

A common mistake in Java is to forget that every statement must end with a semicolon (;).
The error "’;’ expected" on line 7 of Histo.java means that a semicolon is missing at the end of the statement Scanner data = null. In Java, every statement must be terminated with a semicolon (;) to indicate its completion. The arrow points to null because that’s where the compiler expected to find the semicolon.
You have attempted of activities on this page.