This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes uncheked or unsafe operations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Beginning Java
Bookmark "uncheked or unsafe operations" Watch "uncheked or unsafe operations" New topic

uncheked or unsafe operations

akashvinay vinaydeo

Joined: Nov 02, 2008
Posts: 1
while comiling the following code from Head First servlets & JSP page no.82

i am getting following error uses unsafe or unchecked operations
Recompile with -Xlint:unchked for details

please help:
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 43892
Welcome to JavaRanch

That's not an error, but a warning. If you recompile with javac -Xlint:unchecked it will tell you what it thinks the problem is.
What it means is that there is a risk of your putting something into the Lists and trying to get it out as a different type, in which case there will be a ClassCastException thrown.
That sort of warning only started appearing when Java5 was introduced in Autumn 2004. It can be obviated by using generics, but that is probably too advanced a topic for the earlier pages of a Head First book. By the way: was that book printed before Autumn 2004?
I agree. Here's the link:
subject: uncheked or unsafe operations
It's not a secret anymore!