I submitted my code written in java and recived the following errors. what may be the possible reason for that;
“Main.java:6: cannot find symbol
symbol : class Set
location: class Main
Set s=new TreeSet();
^
Main.java:6: cannot find symbol
symbol : class TreeSet
location: class Main
Set s=new TreeSet();
^
Main.java:7: cannot find symbol
symbol : class Scanner
location: class Main
Scanner s1=new Scanner(System.in);
^
Main.java:7: cannot find symbol
symbol : class Scanner
location: class Main
Scanner s1=new Scanner(System.in);
^
Main.java:20: cannot find symbol
symbol : class Iterator
location: class Main
Iterator i=s.iterator();
^”
@d_stallion as told by @gage import java.util* and remove public from the class and one thing no need to store the numbers in Treeset, just print the numbers after the conditon is checked (means if numbers is not equal to 42 , just print it otherwise break from the loop). link to accepted solution … Happy Coding