0

Hello guys, just wanna ask help from you again. I just reviewed my notes and tried to run the code, I successfully debugged it but when I ran the code it says

java.lang.NoSuchMethodError: main
Exception in thread "main"
Process completed.

I just don't know what to do. =/ here's my code:

import java.io.*;
public class Test6
{
	public static BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
	{
	int choice=0;
	try{
	System.out.println("Pick a mystery fruit \nEnter 1,2,or3");
	choice=Integer.parseInt(input.readLine());
	}
	catch(IOException ioe) {}
	
	if(choice==1){
	System.out.println("You picked a Banana");
	}else if(choice==2){
	System.out.println("You picked an Apple");
	}else if(choice==3){
	System.out.println("You picked an Orange");	
	}else{
	System.out.println("Choice not recognize");
	}
  }
}
2
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by iCez
0

You missing main method. So either implement main method in your code or create another class with main method that will make use of yout Test6 class

0

yay.. my fault.. lol.. I forgot to input something.. thank you sir! =)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.