Life Cycle of an Object Code Samples
Learn basic language constructs to start writing applications with the Java programming language.
- Creating Objects
- Garbage Collection
- Using Objects
Creating Objects
- Point.java shows how to pass data to a constructor to initialize an object. For supporting information see The Java Tutorial: Object Basics and Simple Data Objects.
- Rectangle.java shows how to use multiple constructors to initialize an object with different aspects of data. For supporting information see The Java Tutorial: Object Basics and Simple Data Objects.
Garbage Collection
- SocketThrdServer. java shows how to use a finalize method to let a multithreaded socket program clean up and release resources before exiting. For supporting information see Essentials of the Java Programming Language: Socket Communications
Using Objects
- CharacterDemo.java creates a few character objects and displays some information about them. For supporting information see The Java Tutorial: Object Basics and Simple Data Objects.