import java.lang.reflect.*;
class Start
{
public static void main( String[] argv )
{
String me, klasa;
Object arg;
Method met;
int v=argv.length-1;
int argc =argv.length;
if ( argc == 0 ) {
System.err.println( "err!!!");
return;
}
try
{ while (argc!=0)
{
Class<?> c = Class.forName(argv[v]);
klasa = (String) c.newInstance();
Method[] m = InfoInterface.class.getMethods();
arg = m[2].invoke(c.newInstance());
me = (String) m[1].invoke(c.newInstance());
klasa = (String) m[0].invoke(c.newInstance());
met = klasa.getClass().getMethod(me, String.class);
met.invoke(klasa, arg);
--argc;
}
}
catch ( Exception e ) { System.out.println(e) ; return; }
}
}
I dont know why in this code shows me ClassCastException. I have searched the error since hour and i have no idea what's wrong with it. Help me please!
The classes to program are add via commend line.
Aucun commentaire:
Enregistrer un commentaire