public void menu()
int option=0;
Scanner b= new Scanner(System.in);
while (true){
System.out.println("Your options is:");
option=b.nextInt();
b.nextLine();
if(option==1)
add();
else ...
I make the call of function add in my main,it takes input values the way it should but when it comes again in the while,everything crashes.
> public void add(){
> int id;float grade; String name;
> Scanner z= new Scanner(System.in);
> //taking values for the 3 vars
> Student s= new Student(id,name,grade);
> c.addC(s);
> z.close();}
addC is in the Ctrl package and it looks kind of like this
public void addC(Student s){
if(findById(s.getId()) != null)
{System.out.println("Err!Duplicate id!/n");
}else
if(s.getGrade()>10)
System.out.println("Err!Grade bigger than 10!/n");
else{
x.push(s);}
push() is there because I try to implement it on a stack.The error line is option=b.nextInt()
I feel like It's my fault but as a java-starter I can;t figure it out by myself,any ideeas?