How to Access package private Class from a Class in some other package?

后端 未结 10 1283
情歌与酒
情歌与酒 2020-12-13 21:57

I have following classses

Hello.java

package speak.hello;

import java.util.Map;

import speak.hi.CustomMap;
import speak.hi.Hi;

public cla         


        
10条回答
  •  一向
    一向 (楼主)
    2020-12-13 22:38

    I would think that if the authors of a library did not make a particular class part of the public API, it is because they don't want other people using it. You should respect the decision even though you can break it using reflection. Using private API is simply bad programming.

提交回复
热议问题