File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5542,7 +5542,120 @@ class Example3{
55425542
55435543</h3 >
55445544
5545+ <h3 ><i >Similarly,in Multiple Upper Bound :</i ></h3 >
55455546
5547+ <h3 align =" Left " >
5548+
5549+ ```
5550+ ++++++++
5551+ + Eg-4 +
5552+ ++++++++
5553+
5554+ import java.util.AbstractList;
5555+ import java.util.ArrayList;
5556+ import java.util.List;
5557+
5558+ abstract class A2<T extends AbstractList<Number>&List<Number>>{
5559+ public abstract T m(T a);
5560+ }
5561+
5562+ class Example3{
5563+ public static void main(String[] args) {
5564+ A2<ArrayList<Number>> a = new A2< ArrayList<Number>>() {
5565+ @Override
5566+ public ArrayList<Number> m(ArrayList<Number> a) {
5567+ return a;
5568+ }
5569+ };
5570+
5571+ ArrayList<Number> al = new ArrayList<>();
5572+ al.add(1);
5573+ al.add(2.0f);
5574+ al.add(3.33D);
5575+
5576+ System.out.println(a.m(al));
5577+
5578+
5579+
5580+ }
5581+ }
5582+
5583+
5584+ ```
5585+
5586+ </h3 >
5587+
5588+ <h3 ><i >Similarly,using Lower Bound :</i ></h3 >
5589+
5590+ <h3 align =" Left " >
5591+
5592+ ```
5593+ ++++++++
5594+ + Eg-5 +
5595+ ++++++++
5596+
5597+ import java.util.ArrayList;
5598+ import java.util.List;
5599+
5600+ class A2<T extends List<? super Number>>{
5601+ public T m(T a){
5602+ return a;
5603+ };
5604+ }
5605+
5606+ class Example3{
5607+ public static void main(String[] args) {
5608+ A2<ArrayList<Number>> a = new A2< ArrayList<Number>>() {
5609+ @Override
5610+ public ArrayList<Number> m(ArrayList<Number> a) {
5611+ return a;
5612+ }
5613+ };
5614+
5615+ ArrayList<Number> al = new ArrayList<>();
5616+ al.add(1);
5617+ al.add(2.0f);
5618+ al.add(3.33D);
5619+
5620+ System.out.println(a.m(al));
5621+
5622+
5623+ }
5624+ }
5625+
5626+
5627+ ```
5628+
5629+ </h3 >
5630+
5631+ <h3 ><i > Hence, everything depends upon what Type the Super Interface / Class have .</i ></h3 >
5632+
5633+ <h3 align =" Left " >
5634+
5635+ ```
5636+
5637+
5638+ class/ abstract class/Interface Eg <TYPE >{
5639+
5640+ Method();
5641+ }
5642+
5643+ class Ex{
5644+
5645+ Eg <type> e = Eg<type>{
5646+
5647+ @Ovveride
5648+ Method();
5649+
5650+ }
5651+
5652+ }
5653+
5654+ //type depends upon Type
5655+
5656+ ```
5657+
5658+ </h3 >
55465659
55475660</ul >
55485661
You can’t perform that action at this time.
0 commit comments