|
-
February 24th, 1999, 09:02 PM
#1
Problems with Reflection in Java
I am having trouble understanding why the following bit of code results in a NoSuchMethodException. Everyone, please
take a look at this and help me figure out the problem.
/**********************************/
import java.util.*;
import java.lang.reflect.*;
public class test
{
public static void main(String args[])
{
runTest(new HashSet());
}
static void runTest(Set set)
{
try
{
Class the_class=set.getClass();
Class[] args=new Class[] {the_class};
Constructor constructor=the_class.getConstructor(args);
}
catch (Exception e)
{
System.out.println(e);
}
}
}
/**********************************/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|