D.1.1+Outline+the+general+nature+of+an+object

Real-world objects share two characteristics: They all have state and behavior. Dogs have state (name, color, breed, hungry) and behavior (barking, fetching, wagging tail). Bicycles also have state (current gear, current pedal cadence, current speed) and behavior (changing gear, changing pedal cadence, applying brakes). Identifying the state and behavior for real-world objects is a great way to begin thinking in terms of object-oriented programming.

Software objects are conceptually similar to real-world objects: they too consist of state and related behavior. An object stores its state in fields (variables in some programming languages) and exposes its behavior through methods (functions in some programming languages). Methods operate on an object's internal state and serve as the primary mechanism for object-to-object communication. Hiding internal state and requiring all interaction to be performed through an object's methods is known as data encapsulation — a fundamental principle of object-oriented programming.

http://docs.oracle.com/javase/tutorial/java/concepts/object.html

public class student

{ zzzzz public student(int pos, String descr, student ptr) //Constructor zzzzz { zzzzzzzzzz position = pos; zzzzzzzzzz description = descr; zzzzzzzzzz nextNode = ptr; zzzzz } zzzzz public int position; zzzzz public String description; zzzzz public student nextStudent; }



rss url="https://www.diigo.com/rss/user/Beetlebender/D.1.1" link="true" number="10"