Skip to content

Commit 530e241

Browse files
Update README.md
1 parent 729d3fa commit 530e241

File tree

1 file changed

+89
-1
lines changed

1 file changed

+89
-1
lines changed

README.md

Lines changed: 89 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5811,7 +5811,7 @@ Eg <type> e = Eg<type>{
58115811
<h2><li>4. Generic Inner Class </li></h2>
58125812

58135813
<ul>
5814-
<h3><i>Diamond operator was introduced in Java 7 .The main purpose of the diamond operator is to simplify the use of generics when creating an object. The diamond operator could not be used with Anonymous inner classes in JDK 7. In JDK 9, it can be used with the anonymous class as well to simplify code and improves readability. </i></h3>
5814+
<h3><i>Diamond operator was introduced in Java 7 .The main purpose of the diamond operator is to simplify the use of generics when creating an object. The diamond operator could not be used with Anonymous inner classes in JDK 7. In JDK 9, it can be used with the anonymous class as well to simplify code and improves readability. <ins>[As mentioned above] </ins></i></h3>
58155815

58165816
<h3>According to the Java's Inner Class we know : </h3>
58175817

@@ -5934,7 +5934,95 @@ outerObj.LocalMethod();
59345934

59355935
</ul>
59365936

5937+
<h3><li> 2) Anonymous Inner Class </li></h3>
59375938

5939+
<ul>
5940+
5941+
<h3>
5942+
5943+
```Syntax
5944+
5945+
++++++
5946+
Class
5947+
++++++
5948+
5949+
class A{
5950+
LocalMethod(){...}
5951+
5952+
}
5953+
5954+
class B{
5955+
5956+
Main(){
5957+
A a = new A(){
5958+
@override
5959+
LocalMethod(){...}
5960+
}
5961+
}
5962+
5963+
}
5964+
5965+
}
5966+
5967+
++++++
5968+
Abstract Class
5969+
++++++
5970+
5971+
abstract class AnonymousInner {
5972+
abstract LocalMethod();
5973+
}
5974+
5975+
class Inner{
5976+
5977+
Main(){
5978+
5979+
AnonymousInner anIn = new AnonymousInner(){
5980+
@Override
5981+
LocalMethod(){....}
5982+
5983+
}
5984+
5985+
}
5986+
5987+
}
5988+
5989+
++++++
5990+
Interface
5991+
++++++
5992+
5993+
interface A {
5994+
LocalInterfaceMethod();
5995+
}
5996+
5997+
class Eg implements A{
5998+
@Override
5999+
LocalInterfaceMethod(){...}
6000+
6001+
}
6002+
class InnerClass{
6003+
Main(){
6004+
6005+
A a = new A(){
6006+
6007+
@Override
6008+
6009+
LocalInterfaceMethod(){...};
6010+
6011+
}
6012+
6013+
}
6014+
6015+
}
6016+
6017+
6018+
```
6019+
6020+
</h3>
6021+
6022+
<ul>
6023+
<h3><li><a href="https://github.com/AvinandanBose/JavaGeneric/blob/main/InnnerClass9.java"> 1. Anonymous Inner Class- Eg(1)</li></h3>
6024+
<h3><i><ins>Note:</ins> Anonymous Inner Class is already discussed as- "Generic Anonymous Class" . (Above)</i></h3>
6025+
</ul>
59386026

59396027
</ul>
59406028

0 commit comments

Comments
 (0)