Can't find symbol - class Iterator [Java] -
I'm just starting with Java and getting an error: "Finding Hint - Class Iterator"
What's wrong with my code?
Storage for an arbitrary number of public class notebooks {// notes. Private Array List & lt; String & gt; notes; / ** * Perform any initial prerequisites for notebook * / public notebook () {Note = New Arrestist & lt; String & gt; (); } / ** * Store a new note in the notebook * @ The ultimate note note should be archived * / public zoo archive notes (string notes) {notes.add (note); } / ** * @ Layers The number of notes currently in the notebook * / Public Ink numberofonotes () {Return Notes. (); } / ** * Show a note * @ The ultimate note number will be shown to show. * / Public Zero Shows Note (Int note number) {If (note no & lt; 0) {// is not a valid note number, so do nothing} And if (notNumber
Your error message tells you that it is not about class Known iterator
.
This issue will be resolved using an import statement.
import java.util.Iterator above your code; Add
.
In general, whenever you use a class that is not within the underlying java.lang
package, you will need to import that class to the common example Java.util.ClassHere come from
, like
import java.util.List; // import class java.util.Scanner to keep a list of items; / / Keyboard to read in the entry etc. // my code here
Comments
Post a Comment