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
|