-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCh08_37_OOPs_Imp.java
More file actions
42 lines (33 loc) · 2.42 KB
/
Ch08_37_OOPs_Imp.java
File metadata and controls
42 lines (33 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
public class Ch08_37_OOPs_Imp {
public static void main(String[] args) {
System.out.println(" ");
/* OOPs - Maps the code with the real world
example : A bottle it can be used in various ways like closing it , opening it or filling
That is just like bottle is connected to real world through our actions
OOPs connect our code very close to our real world. */
// OOPs shortens or makes complex code easier. " WORKS ON DRY PRINCIPLE "
// Example : If we want a link at different pages on a website , rather than coding it on each page
// we use OOPs to code it once on base and use it on different sites.
// Class - its a blueprint where you make objects (Pre designed template)
// Objects - It is an real world entity formed from a Class (Memory is allocated after object instantiation.
// It has all the valid information to create objects
// Example: JEE application form (Class) Filled by student (Object making) - Application received (Object).
/* How to model a problem in OOPs - (Follow NAV RULE)
We identify the following : 1. Noun - Class - The Employee Name (WHO)
2. Adjectives - Attributes - Salary , name , age etc (his/her specs)
3. Verbs - Methods - give_salary() , increment() (ACTIONS) */
// *********** \\
// OOPs Terminology:- ('A'n 'E'ngineer 'I's 'P'erfect)
/* 1.Abstraction - Hiding the inner details that is showing only essential info.
Ex. An object we work upon , we are only bothered on how to work on it and not How it was made.
Ex. Android web development , we use app rather than digging deep into its development.
2.Encapsulation - Putting components together
Ex. Device is a single entity with various parts.
Ex. In java it means class is a capsule where all the components are put together thereby hide inner data.
3.Inheritance - Using older things to develop something new. (DRY)
Ex. Someone made smartphone won't develop another from scratch and will use developed technology.
It saves time
4.Polymorphism - One entity but many forms.
Ex. Using smartphones to call , to take photos , to use as calculator and much more. */
}
}