I have a question why is important to supress warnings in java, i notice my professor do that all the time
@SuppressWarnings("unchecked")
My rule is NEVER to suppress warnings! They are there for a reason, and sometimes they give good indications that some code is going to be problematic. Your professor may suppress them for class projects because he knows they are "noise". Myself, I have to design and build systems that support quite literally millions of users, and that have to run ABSOLUTELY 24x365 with zero downtime (results are not fatal in my current position like they could have been in my previous job, but really irritate our users, who can easily switch to another service). So, our goal is to build code with zero warnings, and if there are, they need to be documented and explained.
So, use your discretion, but realize that the habits you learn today will be what guide you in your career, and if that is going to be systems or software engineering, then it can be a problem for you if you start cutting corners now. FWIW, I am Senior Systems Engineer for one of the biggest mobile phone companies in the world, and in a previous incarnation was Principal Architect and Engineer for the manufacturing execution system that runs most of the semiconductor, flat-screen display, and disc drive manufacturing plants in the world today. There, we would not tolerate suppressing warnings from compilers - our customers would lose over $10M USD in profits for every hour their systems were down, and a 5 minute software glitch could result in hours of fab downtime. In our case 6-sigma uptime was not good enough.
In Java 1.5 there were some significant enhancements to the language (particularly Generics) and many classes were updated to use the new language features. Code written before 1.5 still works, but the compiler issues warnings where the code should be updated to the new standards.
If you're still re-hashing the same tired old course material that you've had for 10 years it's easier to suppress the warnings than to update your material - it doesn't matter if you're teaching bad practice.
In Java 1.5 there were some significant enhancements to the language (particularly Generics) and many classes were updated to use the new language features. Code written before 1.5 still works, but the compiler issues warnings where the code should be updated to the new standards.
If you're still re-hashing the same tired old course material that you've had for 10 years it's easier to suppress the warnings than to update your material - it doesn't matter if you're teaching bad practice.
Very good point James. I tend to babble on. Your reply was spot on with regard to Java in particular. I had been out of Java programming for 6-7 years until recently, and have been seeing exactly the sort of warning you speak of when compiling my new company's code base. Because I am now the senior performance engineer for this product line, such warnings are important to me as much now as when I was principal engineer on major C and C++ projects.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.