dimanche 30 mars 2014

Trying to call a method within an if else.. Where am I going wrong?


Vote count:

-1




I'm writing a program that, for sake of ease, I would like to call a function from within an if/if else. I keep getting the message "non-static method select1() cannot be referenced from a static context".


Sample of code: If else, leading to method:



option = input.nextInt();

if (option == 1){select1();}
if (option == 2) {System.out.println("boo");}
if (option == 3) {System.out.println("hehe");}
else {System.out.println("blahh");}

}


}

static void main select1();{

System.out.println("");};


I'm relatively new at programming, so any help would be great!



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire