Hi, Andrei, Unfortunately, your code came through quite garbled -- probably some weird interaction between your mailer and the mailing list software. Could you please re-send your message as plain text?
You also didn't mention what version of X10 you were using, though from the "!" in the signature of main() I assume it was X10 2.0. Igor Andrei Blackness <k7...@yahoo.com> wrote on 12/01/2009 05:07:43 AM: > Can someone please tell me what is wrong with this code? > > public > Console.OUT.println( > } > Console.OUT.println(classHello {publicstaticdefmain(args: > Rail[String]!){if(args.length>0){"The first arg is: "+args(0));"Enter > a number: ");valh = newHello(); // final variable h.myMethod(); > } > Console.OUT.println( > Console.OUT.println( > s++; > } > Console.OUT.println(s); > } > } > } > > and the result is > Enter a number: 10The read number is: 10 > The sum of the first 10 > numbers is: java.lang.NumberFormatException > " > at java.lang.NumberFormatException.forInputString(Unknown Source) > at java.lang.Integer.parseInt(Unknown Source) > at java.lang.Integer.parseInt(Unknown Source) > at Hello.myMethod( > at Hello.main( > at Hello$Main$2.apply( > at x10.runtime.Runtime$4.apply( > at x10.runtime.Activity.run( > at x10.runtime.Runtime$25.apply( > at x10.runtime.impl.java.Runtime.runAt( > at x10.runtime.Runtime.run( > at x10.runtime.Worker.loop( > at x10.runtime.Worker.apply( > at x10.runtime.Pool.apply( > at x10.runtime.Runtime.start( > at Hello$Main.main( > at x10.runtime.impl.java.Runtime.run( > at java.lang.Thread.run(Unknown Source) > > > As far as I understand, the readLine function reads a string, and Int. > parseInt(string) will convert it to a number, the question is what I > do wrong... can someone please tell me? Thank you.: For input string: > "10Hello.java:130)Hello.java:93)Hello.java:52)Runtime.java:310) > Activity.java:127)Runtime.java:1599)Runtime.java:101)Runtime.java: > 1566)Worker.java:302)Worker.java:193)Pool.java:207)Runtime.java:317) > Hello.java:35)Runtime.java:46)/** x10doc comment for myMethod */; > publicdefmyMethod(){try{vallimit:String = Console.IN.readLine();"The > read number is: "+limit);"The sum of the first "+limit+" numbers is: > ");vars:int=0;valn:int = Int.parseInt(limit);for(vari:int=0;i<n;i++) > {catch(e:IOException){} -- Igor Peshansky (note the spelling change!) IBM T.J. Watson Research Center XJ: No More Pain for XML's Gain (http://www.research.ibm.com/xj/) X10: Parallel Productivity and Performance (http://x10.sf.net/) ------------------------------------------------------------------------------ Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev _______________________________________________ X10-users mailing list X10-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/x10-users