• Post Reply Bookmark Topic Watch Topic
  • New Topic

NZEC(Non Zero Exit Code) exception in java  RSS feed

 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there

this is my code that I am submitting on a online judge. I am getting NZEC exception in my code

this is my code



Can anyone point out what are the causes that is showing NZEC to me?


Thanks
 
Liutauras Vilda
Sheriff
Posts: 4914
334
BSD
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Lines 58, 65. Check them.
Your recursion method declaration is not correct or recursive call list of parameters (depending on what you want to do).
You cannot use different amount of parameters in recursive call. Parameters values has to be different, but the list of parameters has to remain the same.

Edit: ok, I noticed now, that you have overloaded methods, and this is what you're using.
Then problem is not there.
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Liutauras Vilda wrote:

Edit: ok, I noticed now, that you have overloaded methods, and this is what you're using.
Then problem is not there.


What else can be cause of NZEC?
 
Campbell Ritchie
Marshal
Posts: 56518
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which “online judge”? I have tried a few online Java® interpreters and found them to behave incorrectly. Run your program on a command line and find out what really goes wrong.

Also tell us what it is supposed to do and what actually happens.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16057
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would be a lot easier to help you if you explained what the program is supposed to do.

Did you test it yourself? Is the result correct according to you? What is the result supposed to be?
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Which “online judge”? I have tried a few online Java® interpreters and found them to behave incorrectly. Run your program on a command line and find out what really goes wrong.

Also tell us what it is supposed to do and what actually happens.



I can't disclose name of judge not allowed .
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any way that I can view My Java Programs logs?


Like in case of android their is logcat.
Is it possible in java program to?
 
Mike. J. Thompson
Bartender
Posts: 689
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where is your java program logging to? There is no standard log for a java program, and if you don't specifically set up logging then there is no log at all.

However if your program throws an exception that it doesn't handle then the jvm will print a stack trace. This will probably go to standard error or standard out, unless you redirect it elsewhere.
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Eclipse
 
Mike. J. Thompson
Bartender
Posts: 689
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then the stack trace I mentioned will probably appear on the Eclipse console if you're running it from eclipse.

Are you sure your program is throwing an Exception though?
 
Mike. J. Thompson
Bartender
Posts: 689
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And what is a NonZeroExitCodeException, that isn't part of the standard Java library as far as I'm aware. Where is this being reported?
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I said I can't discuss name of judge but typeing NZEC in google while give you a hint which judge I am using
 
Mike. J. Thompson
Bartender
Posts: 689
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well if the ZNEC is coming from the online judge then its nothing to do with your code. Rather your code is not doing something that the judge is expecting it too.

I expect your code is throwing an exception and the judge notices that the java command exited with a non-zero error code.

So, you'll have to run your code yourself using the same input the judge is using, and see what happens.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16057
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kishor Joshi wrote:Is there any way that I can view My Java Programs logs?


Like in case of android their is logcat.
Is it possible in java program to?

You can just use System.out.println() statements in your program to print out the value of variables at certain points. Or you can use Eclipse's debugger to step through the program line by line.

You still haven't told us what your program is supposed to do, and if you tested it yourself to see if it's correct.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!