java.lang.ArrayIndexOutOfBoundsException -


i'm novice java programmer. dont know wrong main method, keeps pointing me line

    int x = integer.parseint(args[0]); 

this code

public static void main(string[] args) {      assert args.length == 1;     int x = integer.parseint(args[0]);     while (x != 1) {         x = nextint(x);         system.out.print(" " + x);     } }  public static int nextint(int x) {     if (x % 2 == 0) {         return x / 2;     } else         return 3 * x + 1; } 

i'm going assume using number in first argument of program call.

you using asserts, verify assertions activated. execute code vm argument: -ea.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -