|
You see two lists on the Applet pane at the left.
One shows classes and objects, the other shows
public members of the selected class or object.
Please follow directions on the right pane below
and observe the result in the gray message area.
Instructions:
1. Click on String MSG = "..."
and press Enter
2. Click on charAt(int) and
enter 0 in the dialog
3. Click on endsWith(String),
type "full", press Enter
4. Click on ===String===
5. Click on valueOf(double),
type 3.1416, press shift TAB,
enter pi as object name
6. Click on length()
7. Click on mae.util.Small ,
then on new Small(), and
enter s in the dialog
8. Click on getFrame(), and
enter frm in the dialog
9. Type dispose on command area
(lower left) and press Enter
|
- MSG is a field in class Small. It is a String
instance. We display its value by clicking on it.
The border color changes to yellow, meaning an object.
- charAt(int) is a method in class String.
We invoke it with argument 0.
The result is char 'S' which is displayed in the gray
message area and in Java Console.
- We invoke another method on the same object.
The result is false.
- We display the class of the current object by
clicking on the separator with "===".
The border color changes back to green, meaning a class.
- String class has several static methods with name
"valueOf". We invoke the one with a float argument
and get another String object, with hame "pi".
If we fail to supply a name, SSS will assign one.
- Another instance method is invoked.
Since it has
no arguments and no object is returned, the parameter
dialog was not shown.
- We display the original class Small, and invoke
a cunstructor with no arguments.
The resulting object is named "s".
- Display the JFrame instance by invoking getFrame().
It has several hundred methods and no public fields.
(Static fields are not shown with objects)
- Finaly, invoke method dispose(), by using the command area.
It could also be invoked by clicking on "dispose()".
|
At this point, you should see 3 classes and 4 objects.
If you open Java Console, this is what you will get:
class mae.util.Small
MSG = Small.MSG; //--> "Small is beautiful"
MSG.charAt(0); //--> S
MSG.endsWith("full"); //--> false
class java.lang.String
pi = String.valueOf(3.1416); //--> "3.1416"
pi.length(); //--> 6
s = new Small(); //--> @44d04d
frm = s.getFrame(); //--> frame0 - Small...
frm.dispose();
|
|