Java Reference
In-Depth Information
In this example, the constructor for MyClass is
This constructor assigns the instance variable x of MyClass the value 10. This constructor
is called by new when an object is created. For example, in the line
the constructor MyClass( ) is called on the t1 object, giving t1.x the value 10. The same is
true for t2 . After construction, t2.x has the value 10. Thus, the output from the program is
Search WWH ::




Custom Search