java reflection

Posted by user622222 on Stack Overflow See other posts from Stack Overflow or by user622222
Published on 2011-02-21T12:09:30Z Indexed on 2011/02/27 23:25 UTC
Read the original article Hit count: 211

Filed under:
|

Hi all,

        System.out.println("Class name : ");
        BufferedReader reader= new BufferedReader(new InputStreamReader(System.in)); 

        String line = reader.readLine();

        Class<?> writeoutClass = Class.forName(line);

        Method Writeout = null;
        for (Method mth : writeoutClass.getDeclaredMethods()) {
            if (mth.getName().startsWith("Writeout")) {
                Writeout = mth;
                break;
            }

It's giving error like that; java.lang.ClassNotFoundException: a How can i generate that class?

© Stack Overflow or respective owner

Related posts about java

Related posts about reflection