You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+40-1Lines changed: 40 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5228,7 +5228,46 @@ public class Example {
5228
5228
5229
5229
</ul>
5230
5230
5231
-
<h2><li>3. Sub Types </li></h2>
5231
+
<h2><li>3. Raw Types And Sub Types </li></h2>
5232
+
5233
+
<ul>
5234
+
<h3><i><ins>Raw Types:</ins></i> Raw types in Java Generics are a way to use a generic class or method without specifying its type parameters. Raw types are created by omitting the type parameter(s) from the generic class or method name.</h3>
5235
+
5236
+
<h3align="Left">
5237
+
5238
+
```
5239
+
import java.util.ArrayList;
5240
+
import java.util.List;
5241
+
5242
+
public class Example <T extends List<Number>>{
5243
+
public static <T>void printList(List<? super Number> list) {
5244
+
for (Object o : list) {
5245
+
System.out.println(o);
5246
+
}
5247
+
}
5248
+
5249
+
public static void main(String[] args) {
5250
+
Example eg = new Example();
5251
+
List<Number> li = new ArrayList<>();
5252
+
li.add(1);
5253
+
li.add(2);
5254
+
eg.printList(li);
5255
+
5256
+
5257
+
}
5258
+
5259
+
}
5260
+
5261
+
```
5262
+
5263
+
</h3>
5264
+
5265
+
<h3> <i> Here "Example eg = new Example();" is in raw type i.e. doesnot mention "Type" in " < > " operator. </i></h3>
0 commit comments