Java:je n'arrive pas executer mon prg

Résolu
domxaline -  
 domxaline -
Bonjour,
en executant mon prg,j'ai une boite à message apparait en disant
"fatal exception occured program will exit" OK

et encore erreur aussi
java.lang.NoSuchMethodError: main
Exception in thread "main"

import java.lang.annotation.*;
import java.lang.reflect.*;
@Retention(RetentionPolicy.RUNTIME)
@interface MySingle
{
 int value( );//this variable name must be value
}
public class Single 
{
 //annotate a method using a marker
	@MySingle(100)
	public static void myMeth( )
	{
		Single ob=new Single ();
		try
		{ 
			
			Method m=ob.getClass().getMethod("myMeth");
			MySingle anno=m.getAnnotation(MySingle.class);
			System.out.println("This value is:"+anno.value());
			//displays 100
		}
		catch(NoSuchMethodException exc)
		{
			System.out.println("Method not found.");
		}
		public static void main(String[]args)
		{
			myMeth();
		}		
	}
}



public static void main(String[]args)

main souligné
en pointant avec le curseur de souris m'indique
"void is an unvalid type for the variable main"

) après ce parenthèse souligné aussi
syntax error on token ")" ,; expected

A voir également:

2 réponses

KX Messages postés 16761 Date d'inscription   Statut Modérateur Dernière intervention   3 020
 
Il faut fermer les accolades de la méthode myMeth avant de déclarer la méthode main
0
domxaline
 
cool merci beaucoup,ça marche
0