Is it possible in java to declare and instantiate a class at runtime?

I am attempting following code:

```
    public static void t4() {
    Object o = new Object() {
        private String uid = "1";
        private String name = "2";

        public String getName() {
            return name;
        }

        public String getUid() {
            return uid;
        }

        public void setName(String name) {
            this.name = name;
        }

        public void setUid(String uid) {
            this.uid = uid;
        }

        @Override
        public String toString() {
            return uid + " " + name;
        }
    };

```

But, I would want this to happen using reflection, cause i will be injecting attributes into pojo from xml source.

Any more thoughts?