how to create a dynamic class at runtime in Java

Posted by Mrityunjay on Stack Overflow See other posts from Stack Overflow or by Mrityunjay
Published on 2010-06-05T13:01:03Z Indexed on 2010/06/05 13:02 UTC
Read the original article Hit count: 151

Filed under:
|
|

hi, is it possible to create a new java file from existing java file after changing some of its attributes at runtime??

Suppose i have a java file

pubic class Student{

    private int rollNo;
    private String name;
    // getters and setters
    // constructor
}

is it possible to create something like this, provided that rollNo is key element for the table..

public class Student {
   private StudentKey key;
   private String name;
   //getters and setters
   //constructor
}
public class StudentKey {
    private int rollNo;
    // getters and setters
    // construcotors
}

please help..

© Stack Overflow or respective owner

Related posts about java

Related posts about class