• 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


this is giving me NZEC exception.I am testing this solution on a online judge.So I don't have any TestCase in which this is failing.So can anyone help me what are the possible reason of NZEC exception in my code?


Thanks
 
Liutauras Vilda
Sheriff
Posts: 4928
334
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It more likely can cause ArrayIndexOutOfBounds exception. This is what is meant probably, just in more general form if you got it tested on some kind online testing tools (not sure what they are).
And you should make your code more readable, at least ask for a specific inputs, as now not clear enough, what kind of inputs you are expecting.
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kishor Joshi wrote: . . . I am testing this solution on a online judge.So I don't have any TestCase in which this is failing.So can anyone help me what are the possible reason of NZEC exception in my code?


Thanks
Faults with the online compiler, most likely. Don't use those compilers; I have never seen one which works correctly. I ran your code on Eclipse and it terminated normally.
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Campbell hmmmm
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
More like Campbell, you're right.

I ran your code and didn't get any non‑zero exit code things. Exit codes are not a usual Java® feature and there is no such Exception in the standard Java8 API. Exit codes are a C feature. Liutauras Vilda correctly says you will suffer another Exception if there are not enough Strings or if they are too short, but that is a different problem caused by your program not telling the user what input is required.
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!