Question: How do I make a third-party class public? Is there a way? any hacks?

Basically I what to extend the functionality of a class which i don't own. I can see the source but don't want to hack the original source and re-compile it.

thanks

Answer: 
Assuming the class isn't nested and is a top-level class (which is actually `public` with a `private` constructor), just create a `public` wrapper class and have method calls into an instance of that class with a `private` constructor. A similar [answer can be found here](https://stackoverflow.com/a/3952820/2591612).
Using java reflection is best way to do it although I think what you want is you want to access a field or method and here is how you can do it using java reflection:

```
////you main class which does the magic
package mytest;

import java.lang.reflect.Field;
import java.lang.reflect.Member;

public class Testing {
        public static void main(String[] args) throws Exception {
            Person c = new Person();
            try {
                Field f = Person.class.getDeclaredField("a");
                f.setAccessible(true);
                Integer i = (Integer)f.get(c);
                System.out.println(i);
            } catch (Exception e) {}
        }
}
///here is another class for this test called person
package mytest;

class Person {
    private Integer a =6;
}

```