INTRODUCTION TO OOP ,OBJECTS AND CLASSES

NOW HERE IS AN 
INTRODUCTION TO OOP ,OBJECTS AND CLASSES AND FUNCTIONS

OBJECT ORIENTED PROGRAMMING:

OOP is a design philosophy. It stands for Object Oriented Programming. Object-Oriented Programming (OOP) uses a different set of programming languages than old procedural programming languages (C, Pascal, etc.). Everything in OOP is grouped as self sustainable "objects". Hence, you gain re-usability by means of four main object-oriented programming concepts.


OBJECT:
An object can be considered a "thing" that can perform a set of related activities. The set of activities that the object performs defines the object's behavior. For example, the hand can grip something or a Student (object) can give the name or address.
In pure OOP terms an object is an instance of a class.



CLASS:

class is simply a representation of a type of object. It is the blueprint/ plan/ template that describe the details of anobject. A class is the blueprint from which the individual objects are created. Class is composed of three things: a name, attributes, and operations.
public class Student
{
}
According to the sample given below we can say that the student object, named objectStudent, has created out of theStudent class.

A Java method is a collection of statements that are grouped together to perform an operation. When you call the System.out.println method, for example, the system actually executes several statements in order to display a message on the console.
Now you will learn how to create your own methods with or without return values, invoke a method with or without parameters, overload methods using the same names, and apply method abstraction in the program design.
A method definition consists of a method header and a method body. Here are all the parts of a method:
·         Modifiers: The modifier, which is optional, tells the compiler how to call the method. This defines the access type of the method.

·         Return Type: A method may return a value. The returnValueType is the data type of the value the method returns. Some methods perform the desired operations without returning a value. In this case, the returnValueType is the keyword void.


·         Method Name: This is the actual name of the method. The method name and the parameter list together constitute the method signature.

·         Parameters: A parameter is like a placeholder. When a method is invoked, you pass a value to the parameter. This value is referred to as actual parameter or argument. The parameter list refers to the type, order, and number of the parameters of a method. Parameters are optional; that is, a method may contain no parameters.


·         Method Body: The method body contains a collection of statements that define what the method does.

·         In creating a method, you give a definition of what the method is to do. To use a method, you have to call or invoke it. There are two ways to call a method; the choice is based on whether the method returns a value or not.


·         When a program calls a method, program control is transferred to the called method. A called method returns control to the caller when its return statement is executed or when its method-ending closing brace is reached.




·         If the method returns a value, a call to the method is usually treated as a value. 
  • INTRODUCTION TO OOP ,OBJECTS AND CLASSES
  • Shubam Bharti
  • Monday 31 March 2014
  • No comments:
 

0 comments:

Post a Comment