站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Java Tutorial 5.0 英文版

Manipulating Objects - Java Tutorial 5.0 英文版

The JavaTM Tutorial
Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail Search
Feedback Form

Trail: The Reflection API

Lesson: Manipulating Objects

Software development tools, such as GUI builders and debuggers, need to manipulate objects at runtime. For example, a GUI builder may allow the end-user to select a Button from a menu of components, create the Button object, and then click the Button while running the application within the GUI builder. If you're in the business of creating software development tools, you'll want to take advantage of the reflection API features described in this lesson.

This lesson has the following sections:

Creating Objects

How can you create an object if you don't know its class name until runtime? You'll find the answer in this section.

Getting Field Values

In this section you'll learn how to get the values of an object's fields, even if you don't know the name of the object, or even its class, until runtime.

Setting Field Values

Not only can you get field values at runtime, you can also set them. This section shows you how.

Invoking Methods

This section shows you how to dynamically invoke methods. Given an object, you can find out what methods its class defines, and then invoke the methods.

Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail Search
Feedback Form

Copyright 1995-2005 Sun Microsystems, Inc. All rights reserved.