Why "always" a wrong answer or an NZEC?

I have solved PROGRAM DS10

I tried this on my computer on BLUEj… It worked.
I tried executing it on cmd … I got a funny error
“sum.java:3: error while writing sum: sum.class (Access is denied)
class sum
^
1 error”
//Later it worked fine as i had forgot to run “cmd” with admin privileges…
I submitted it many times on codechef…I got an NZEC or WRONG ANSWER in different cases.
NZEC-Why am I/my program supposed to return zero! My return type is void!!!
Wrong answer-How and WHY is the program fine on my pc…JAVA is platform independent and “WORA”
And why is “this” program working fine on codechef while mine isn’t ??