-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBasicOOP.java
More file actions
62 lines (40 loc) · 1020 Bytes
/
Copy pathBasicOOP.java
File metadata and controls
62 lines (40 loc) · 1020 Bytes
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
* Object, Class, Inheritance, Polymorphism, Abstraction, Encapsulation
*
* Coupling, Cohesion, Association, Aggregation, Composition
*/
public class BasicOOP {
int classVariable = 123;
/*
* (1). Constructor No return Type
* (2). Same name as Class name
* (3). Parameterized
* (4). non-Parameterized
*/
public BasicOOP() {
System.out.println("Contructor");
}
public BasicOOP(int classVariable) {
// 'this' refer current Object
this.classVariable = classVariable;
System.out.println(classVariable);
}
public void getData(String data) {
System.out.println("Data get Successfully.");
}
public static void getDataStatic(String data) {
System.out.println("Static Data get.");
}
public static void main(String[] args) {
/*
* Class object has 3 things
*
* (1). State (2). Behavior (3). Identity
*
*/
BasicOOP basicOOP = new BasicOOP(0);
basicOOP.getData("Java");
// static method call without create object
getDataStatic("java");
}
}