OOP'S means Object Oriented Programming Structure or System.
OOP'S is a technique which is followed by multiple programming languages.
OOP'S technique was started from CPP programming languages and completely implemented
by Java Programming languages.
JAVA programming language is not 100% Object-oriented because of Java language use primitive datatype which has developed by C and C++ Programming language.
Smalltalk is the language which is 100% Object Oriented.
Features Rules
...............................................................................................................................................
1 Security Data abstraction and encapsulation
2 Code Reusability Inheritance
3 Accessibility Access Control
4 Memory Management Garbage Collector
5 Usability Static Polymorphism or Overloading
6 Extendibility Dynamic polymorphism
7 Dynamic and Static Memory Object and Class
..............................................................................................................................................................
Class and Object:-
..........................................................................................................................
identity means a unique address.
Component of Class:-
1 Data Member:- it is used to defining the attribute of Object and Class.
it will be declared as a variable or constant.
Type of Data Member:-
1.1 Static Data Member:-
it is called Class type data member .it will be called by Classname.it will allocate memory at compilation time.
static datatype variable name;
1.2 Dynamic Data Member
2 Member Function
3 Constructor
4 Static Block
5 Inner Class
6 Initializer Block
OOP'S is a technique which is followed by multiple programming languages.
OOP'S technique was started from CPP programming languages and completely implemented
by Java Programming languages.
JAVA programming language is not 100% Object-oriented because of Java language use primitive datatype which has developed by C and C++ Programming language.
Smalltalk is the language which is 100% Object Oriented.
Features Rules
...............................................................................................................................................
1 Security Data abstraction and encapsulation
2 Code Reusability Inheritance
3 Accessibility Access Control
4 Memory Management Garbage Collector
5 Usability Static Polymorphism or Overloading
6 Extendibility Dynamic polymorphism
7 Dynamic and Static Memory Object and Class
..............................................................................................................................................................
Class and Object:-
..........................................................................................................................
Class:- it is used to define characteristics of Object using Data member and member function.
the class can contain a definition of Single Object and Multiple Objects .in case of Multiple Objects, all object should be related with each other.
for example, Electronic is the class which contains functionalities of electronic items.
Object:- it is a real-world entity that has an identity, state, and behavior.
identity means a unique address.
state means memory allocation.
behavior means functionality.
Structure of Class and Object:-
Class Classname
{
Data member;
Member function.
}
Classsname ref;
ref = new Classname();
Classname ref = new Classname()
.......................................................................................................
.......................................................................................................
A simple example of oops to implement Student Class:-
import java.util.Scanner;
class Student
{
int rno;
String sname;
Scanner sc = new Scanner(System.in);
void accept()
{
System.out.println("Enter rno");
rno = sc.nextInt();
System.out.println("Enter name");
sname=sc.next();
}
void display()
{
System.out.println("rno is "+rno);
System.out.println("name is "+sname);
}
}
class StudentMain
{
public static void main(String args[])
{
Student obj = new Student();
obj.accept();
obj.display();
Student obj1 = new Student();
obj1.accept();
obj1.display();
}
}
Component of Class:-
1 Data Member:- it is used to defining the attribute of Object and Class.
it will be declared as a variable or constant.
Type of Data Member:-
1.1 Static Data Member:-
it is called Class type data member .it will be called by Classname.it will allocate memory at compilation time.
static datatype variable name;
1.2 Dynamic Data Member
2 Member Function
3 Constructor
4 Static Block
5 Inner Class
6 Initializer Block
ASSIGNMENT:-
WAP to Calculate SI using three different methods accept(), logic() and display()?
WAP to manage information of five different employees and calculate the highest salary and total salary of employee;
employee(empid,emp name,salary)
WAP to Calculate SI using three different methods accept(), logic() and display()?
WAP to manage information of five different employees and calculate the highest salary and total salary of employee;
employee(empid,emp name,salary)
POST Answer of Questions and ASK to Doubt