5 / 5
Apr 2010

hi in the problem JULKA me was a compilation error in the class Scanner why ????????????????????????????????
The class Scanner was ok

  • created

    Sep '09
  • last reply

    Apr '10
  • 4

    replies

  • 603

    views

  • 4

    users

6 months later

Have you changed your class name to Main??? Then submit again. Hopefully you won't get the compi. error in the next time.

11 days later

I was doing the TEST problem with Scanner too but got 2 times NZEC... Where I can found a list of classes that I can't use here to not lose time looking for an error that doesn't exist?

Or do I have something wrong on my code?

import java.util.Scanner;
class Main{
    public static void main(String[] args){
	int num = 0;
	Scanner teclado;
	while(num != 42){
		teclado = new Scanner(System.in);			
		num = teclado.nextInt();
		if (num != 42)
			System.out.println(num);
	}
}
}

You have something off...

import java.util.Scanner;
class Main{
   public static void main(String[] args){
      int num = 0;
      Scanner teclado = new Scanner(System.in);
      while(num != 42){
         num = teclado.nextInt();
         if (num != 42)
            System.out.println(num);
      }
   }
}

ahauhahuuha I can't believe this brings a NZEC error blush
Now let me google for how to check for NZEC before sending to spoj...

Thanks leepy for the quick answer smiley

Now I'm happy that I can learn what helps the performance of my programs ^^

Suggested Topics

Want to read more? Browse other topics in JAVA based languages or view latest topics.