| Author |
unchecked warning
|
Changchun Wang
Ranch Hand
Joined: Feb 15, 2006
Posts: 83
|
|
Under what circumstances ,the compiler will generate unchecked warning? I know assign a parameterized type to a raw type and will give warning but List<? extends Comparale> will occur a warning? Generally we use List<? extends Comparale<String>> or other
|
 |
Deepak Bala
Bartender
Joined: Feb 24, 2006
Posts: 6588
|
|
|
I am not sue what you mean by unchecked warning. When you use legacy code like List list = new ArrayList(); and add stuff to this list that might generate warnings. Or when you pass parameterized data to a function that accepts a List list then you might get a warning. When you use generics with collections you will not get warnings. When you mix them with legacy code, watch out.
|
SCJP 6 articles - SCJP 5/6 mock exams - SCJP Mocks - SCJP 5 Mock exam (Word document ) - SCJP 5 Mock exam in Java.Inquisition format
|
 |
Changchun Wang
Ranch Hand
Joined: Feb 15, 2006
Posts: 83
|
|
There are some questions about some code compiling without no warning and compie error. so i want to know warning clearly thanks you replies
|
 |
Deepak Bala
Bartender
Joined: Feb 24, 2006
Posts: 6588
|
|
Compile error is when your code does not compile and no .class file is created Compile with warning is when the compiler tells you that the code that you have written could be risky but it generates a .class file anyway. There are no errors. The warnings are displayed on the console. Compile without warning is when the compiler is fine with the way you have written the code and generates a .class file. There are no errors and no warnings.
|
 |
 |
|
|
subject: unchecked warning
|
|
|