O'Reilly logo

PURE Java™ 2 by Kenneth Litwak

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Modifying Data Members and Calling Methods

The three examples so far have shown interrogating classes and interfaces from their class definitions. The methods used so far, such as getFields(), provide static information about what a class looks like. This is useful if you want to get information about what a class or interface contains. If you want to find out about an object and then use it, or find out what fields and methods a class contains so that you can make an instance of that class and modify its values or call its methods, you can use the methods provided by the Reflection APIs. First, you can create an object using a constructor, and then you can set or get attribute values or call methods. You can create an object in Java by calling ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required