Java Class getDeclaredField() MethodThe getDeclaredField() method of java Class class returns a field object representing the specified field declared inside the class or interface of this class. SyntaxParametername - the name of the field ReturnsField object. ThrowsNoSuchMethodException , SecurityException Example 1Test it NowOutput: Field = long ClassgetDeclaredFieldExample1.lng Example 2Test it NowOutput: private int ClassgetDeclaredFieldExample2.intgr public java.lang.String ClassgetDeclaredFieldExample2.str 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