Object Oriented Programming
--A type of programming in which programmers define not only the data type of a data structure, but also the types of operations (functions) that can be applied to the data structure. In this way, the data structure becomes an object that includes both data and functions. In addition, programmers can create relationships between one object and another. For example, objects can inherit characteristics from other objects.
One of the principal advantages of object-oriented programming techniques over procedural programming techniques is that they enable programmers to create modules that do not need to be changed when a new type of object is added. A programmer can simply create a new object that inherits many of its features from existing objects. This makes object-oriented programs easier to modify.
Object-oriented programming (OOP) is a programming paradigm that uses "objects" – data structures consisting of datafields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction, encapsulation, modularity, polymorphism, and inheritance. It was not commonly used in mainstream software application development until the early 1990s
Encapsulation
--In programming, the process of combining elements to create a new entity. For example, a procedure is a type of encapsulation because it combines a series of computer instructions. Likewise, a complex data type, such as a record or class, relies on encapsulation. ObjectOriented ProgrammingLanguages rely heavily on encapsulation to create high-level objects. Encapsulation is closely related to abstraction and information hiding.
Classes And Objects
Class Variables
--A class variable is the opposite of instance variable. It is a special type of class member.
In C++ and C#, class variables are declared with the storage class keyword static, and may therefore be referred to as static member variables.
The same dichotomy between instance and class members applies to methods ("member functions") as well; a class may have both instance methods and class methods. Again, C++ and C# use the keyword static to indicate that a method is a class method ("static member function").
Class instantiation
--is the creation of a real instance or particular realization of an abstraction or template such as a class of objects or a computer process. To instantiate is to create such an instance by, for example, defining one particular variation of object within a class, giving it a name, and locating it in some physical place.
In object-oriented programming with classes, a class variable is a variable defined in a class (i.e. a member variable) of which a single copy exists, regardless of how many objects of the class exist.
Method
Method Declaration
--A method's declaration provides a lot of information about the method to the compiler, the runtime system and to other classes and objects. Besides the name of the method, the method declaration carries information such as the return type of the method, the number and type of the arguments required by the method, and what other classes and objects can call the method.
While this may sound like writing a novel rather than simply declaring a method for a class, most method attributes can be declared implicitly. The only two required elements of a method declaration are the method name and the data type returned by the method. For example, the following declares a method named isEmpty() in the Stack class that returns a boolean value (true or false):
Static Methods
--use no instance variables of any object of the class they are defined in. If you define a method to be static, you will be given a rude message by the compiler if you try to access any instance variables. You can access static variables, but except for constants, this is unusual. Static methods typically take all they data from parameters and compute something from those parameters, with no reference to variables. This is typical of methods which do some kind of generic calculation
Parameter Passing
Pass by value
--- In this method value of the variable is passed. Changes made to formal will not affect the actual parameters.
- Different memory locations will be created for both variables
Pass by reference
--In Pass by reference address of the variable is passed to a function. Whatever changes made to the formal parameter will affect to the actual parameters
- Same memory location is used for both variables.(Formal and Actual)-
- it is useful when you required to return more then 1 values
Monday, April 19, 2010
Working with the java class
Posted by michael_javier at 2:07 AM
Subscribe to:
Post Comments (Atom)

0 comments:
Post a Comment