-
Notifications
You must be signed in to change notification settings - Fork 7
/
FirstOopsApp.java
61 lines (53 loc) · 1.64 KB
/
FirstOopsApp.java
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
public class FirstOopsApp {
/*
* Requirements
* Properties
* Variables
*/
int a = 10;
int b = 20;
int c = 30;
/* Constructor */
public FirstOopsApp() {
System.out.println("FirstOopsApp.FirstOopsApp()");
}
/*
* method name hai
* returntype void
*/
public void hai() {
System.out.println("Hi Srikanth ! How are you");
System.out.println("a value is " + a);
}
/**
* method name hello
* return type void
*/
public void hello() {
System.out.println("Hello Raju ! How are you");
System.out.println("value of b is " + b);
}
public void bye() {
System.out.println("Bye Abhinay ! See you later");
System.out.println("value of c is " + c);
}
public static void main(String args[]) {
/** creating object by using new keyword */
FirstOopsApp firstOopsApp = new FirstOopsApp();
/** using object reference calling the method hai */
firstOopsApp.hai();
/** using object reference calling the method hello */
firstOopsApp.hello();
/** using object reference calling the method bye */
firstOopsApp.bye();
/** same way we can create multiple objects */
/** creating object by using new keyword */
FirstOopsApp firstOopsApp1 = new FirstOopsApp();
/** using object reference calling the method hai */
firstOopsApp1.hai();
/** using object reference calling the method hello */
firstOopsApp1.hello();
/** using object reference calling the method bye */
firstOopsApp1.bye();
}
}