Java Class getDeclaringClass() MethodThe getDeclaringClass() method of java Class class returns the Class object representing the class in which it was declared if the class or the interface represented by this Class object is a member of another class. Otherwise, it returns null. SyntaxParameterNA Returnsdeclaring class for this class. ThrowsSecurityException Example 1Test it NowOutput: Method = public boolean java.lang.Float.equals(java.lang.Object) Declaring class: class java.lang.Float Method = public static java.lang.String java.lang.Float.toString(float) Declaring class: class java.lang.Float Method = public java.lang.String java.lang.Float.toString() Declaring class: class java.lang.Float Method = public int java.lang.Float.hashCode() Declaring class: class java.lang.Float Method = public static int java.lang.Float.hashCode(float) Declaring class: class java.lang.Float Method = public static float java.lang.Float.min(float,float) Declaring class: class java.lang.Float Method = public static float java.lang.Float.max(float,float) Declaring class: class java.lang.Float Method = public static native int java.lang.Float.floatToRawIntBits(float) Declaring class: class java.lang.Float Method = public static int java.lang.Float.floatToIntBits(float) Declaring class: class java.lang.Float Method = public static native float java.lang.Float.intBitsToFloat(int) Declaring class: class java.lang.Float Method = public int java.lang.Float.compareTo(java.lang.Float) Declaring class: class java.lang.Float Example 2Test it NowOutput: class ClassgetDeclaringClassExample2 Next TopicJava Class |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India