-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOOPS_2.java
More file actions
92 lines (71 loc) · 1.65 KB
/
Copy pathOOPS_2.java
File metadata and controls
92 lines (71 loc) · 1.65 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package BASICS;
/* using This to invoke current class method
class This1{
void show(){
System.out.println("This class show method");}
void display(){
System.out.println("Display Method");
this.show();}
public static void main(String []args){
This1 t = new This1();
t.display();
new Test().show();
}}
class Test{
void show(){
System.out.println("Test class show method");}
}
*/
/*
// to invoke current class constructor
class This2{
This2(){
System.out.println("default constructor");}
This2(int x){
this();
System.out.println("parameterized constructor");}
public static void main(String []args){
This2 t = new This2(10);}
}
*/
/*
class ReturnObject{
int a;
ReturnObject(int i){
a=i;}
ReturnObject method(){
ReturnObject ro = new ReturnObject(a+10);
return ro;}
public static void main(String []a){
ReturnObject ro1 = new ReturnObject(2);
ReturnObject ro2 = ro1.method();
System.out.println("a after call "+ro2.a);
ro2 = ro2.method();
System.out.println("a after call "+ro2.a);
}
}
*/
/*
//accessing inner class code from static area of outer class
class Outer1{
class Inner1{
void show(){
System.out.println("inner class method");}
}
void display(){
System.out.println("Outer class method");}
public static void main(String[] args){
Outer1 o = new Outer1();
o.display();
Outer1.Inner1 i = o.new Inner1();
i.show();
//or
//Outer1.Inner1 i = new Outer1().new Inner1();
//i.show();
//or
//new Outer1().new Inner1().show();
}
}
*/
public class OOPS_2 {
}