java 代码编译出错帮忙看看哪里错了,帮我改一下!

来源:百度知道 编辑:UC知道 时间:2024/09/20 21:14:05
import java.lang.reflect.*;
class Test
{
public static void main(String[] args)
{
Class cl = Class.forName(args[0]);
Constructor[] c = cl.getDeclaredConstructors();
Class[] parame = c[0].getParameterTypes();
Object[] parameter= new Object[parame.length];
for(int i=0;i<parame.length;i++)
{
if(parame[i].isPrimitive())
{
parameter[i]=new Integer(i+3);
}
}
Object o = c[0].newInstance(parameter);
Method[] m = cl.getDeclaredMethods();
m[0].invoke(o,null);//————————70行错误

}
catch(Exception e)
{
e.printStackTrace();
}
}
}
class Point
{
static
{
System.out.println("loading Point");
}
int x,y;
void output()
{
System.out.println("x="+x+"y="+y);

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

class Test {
/**
* @param args
* @throws ClassNotFoundException
* @throws IllegalArgumentException
* @throws InstantiationException
* @throws IllegalAccessException
* @throws InvocationTargetException
*/
public static void main(String[] args) throws ClassNotFoundException,
IllegalArgumentException, InstantiationException,
IllegalAccessException, InvocationTargetException {
Class cl = Class.forName(args[0]);
Constructor[] c = cl.getDeclaredConstructors();
Class[] parame = c[0].getParameterTypes();
Object[] parameter = new Object[parame.length];
for (int i = 0; i < parame.length; i++) {
if (parame[i].isPrimitive()) {
parameter[i] = new Integer(i + 3);
}
}
Object o = c[0].newInstance(parameter);
Method[] m =