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");
	}
  }
}

Recommended Answers

All 2 Replies

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.