My primary goal here is just to have an Arraylist or array that holds type Class. What would the easiest way to go about this?
I don't really want to create an object to just to call getClass().
Class[] classes = { someObject.getClass(), someObject1.getClass() };
The most ideal way to do this would be just to just call the name of the class. Is this possible?
Class[] classes = { SomeObject, SomeObject1 };
The reason why I want to do this is because I have a static object that I hold onto and I want to see if it is an instanceOf whatever is in my array.
是的,有可能。
Class[] classes = { SomeObject.class, SomeObject1.class };
我不确定您要达到的目标,但这也许会有所帮助:
Class[] classes = {SomeObject.class, SomeObject1 .class };
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.