The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Dead Code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Dead Code" Watch "Dead Code" New topic

Dead Code

Saibabaa Pragada
Ranch Hand

Joined: Oct 24, 2010
Posts: 162
Hi, This is from examLab. Why am I getting Dead Code warning instead of compiler error.
Trishul P Mukherjee

Joined: Oct 29, 2007
Posts: 17

Please correct me if I'm wrong but I'm not sure if this code is giving any error.
Tested with Eclipse 3.4 and JDK 1.6.0_17 - the compiler isn't showing any errors. Also, the output is 3 - as expected.

OCPJP 6 (83%)
Saibabaa Pragada
Ranch Hand

Joined: Oct 24, 2010
Posts: 162
Hi Trishul, As mentioned there are no errors. It is all about warnings. My question is, Why warning is coming instead of an error. I am expecting error at Line 23 but I am getting only warning.
Arjun Srivastava
Ranch Hand

Joined: Jun 23, 2010
Posts: 432

IMHO This Thread will be helpfull for you.

SCJP 6 | FB : Java Certifications-Help. | India Against Corruption
Devaka Cooray
ExamLab Creator

Joined: Jul 29, 2008
Posts: 3915

"Phunsuk Wangdu", please check your private messages for an important administrative matter.

Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
It is sorta covered in the JavaRanch Style Guide.
subject: Dead Code
It's not a secret anymore!