Specifications

Sun Services
Java™ Programming Language
Module 9, slide 32 of 37
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
Compiler Warnings
javac GenericsWarning.java
Note: GenericsWarning.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
javac -Xlint:unchecked GenericsWarning.java
GenericsWarning.java:7: warning: [unchecked] unchecked call to add(int,E)
as a member of the raw type java.util.ArrayList
list.add(0, new Integer(42));
^
1 warning
0
1 import java.util.*;
2 public class GenericsWarning {
3 public static void main(String[] args) {
4 List list = new ArrayList();
5 list.add(0, new Integer(42));
6 int total = ((Integer)list.get(0)).intValue();
7 }
8}