I just want to know that using just the name of the class/interface ( not fully qualified name),can i get the details of that class/interface i.e by using methods like isinterface(),getSuperClass(),getInterfaces()
.
我只想知道只使用类/接口的名称(不是完全限定名称),我可以获得该类/接口的详细信息,即使用isinterface(),getSuperClass(),getInterfaces()等方法。
I have gone through the Oracle Doc but i could not find any way. Can someone help me with this?
我已经浏览了Oracle Doc,但我找不到任何方法。有人可以帮我弄这个吗?
3 个解决方案
#1
1
No, since you can't have a reference to the class with just the class name, you won't be able to execute any of those methods. Packages are there for a reason.
不,因为您不能仅使用类名引用该类,所以您将无法执行任何这些方法。包裹是有原因的。
#2
1
You can only check your object is a instance of ....class or ....interface by the use of instanceof operator and for other jobs go through with Java Reflection
您只能通过使用instanceof运算符检查您的对象是....类或....接口的实例,并通过Java反射检查其他作业
#3
1
No, It can not be achieved without fully qualified name. To apply mentioned methods you need reference for the class and to have that reference you need fully qualified name of the class.
不,没有完全合格的名称就无法实现。要应用提到的方法,您需要引用该类,并且要获得该引用,您需要该类的完全限定名称。
#1
1
No, since you can't have a reference to the class with just the class name, you won't be able to execute any of those methods. Packages are there for a reason.
不,因为您不能仅使用类名引用该类,所以您将无法执行任何这些方法。包裹是有原因的。
#2
1
You can only check your object is a instance of ....class or ....interface by the use of instanceof operator and for other jobs go through with Java Reflection
您只能通过使用instanceof运算符检查您的对象是....类或....接口的实例,并通过Java反射检查其他作业
#3
1
No, It can not be achieved without fully qualified name. To apply mentioned methods you need reference for the class and to have that reference you need fully qualified name of the class.
不,没有完全合格的名称就无法实现。要应用提到的方法,您需要引用该类,并且要获得该引用,您需要该类的完全限定名称。