Objects


We have talked about Java being an object-oriented programming language. But what exactly is an object? To put it simply, an object is an abstraction that represents something. The "something" might be a gas mixture, a supporting beam, a charged particle, or any other element of your scientific or engineering analysis. An object has two general characteristics ”state and behavior. An object's state represents what the object knows . The state is maintained in one or more variables associated with the object. An object's behavior represents what the object can do. The behavior is implemented by defining methods that the object can access. Simply put, a method is a named block of code that does something.

In Java, an object is an instance of a class. Java arrays are also objects, but their class is internally defined. An object contains its own copy of the nonstatic fields declared by the class. A class can declare variables that are reference types (objects and arrays) as well as primitive types such as the char , int , and double . In your Java programs you will likely create one or more objects and manipulate the state of the objects by calling methods on them.



Technical Java. Applications for Science and Engineering
Technical Java: Applications for Science and Engineering
ISBN: 0131018159
EAN: 2147483647
Year: 2003
Pages: 281
Authors: Grant Palmer

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net