I have just joined SPOJ and this was the first problem I tried. My source code was:
import java.util.*;
public class SOJ1
{
public static void main()
{
Scanner sc = new Scanner(System.in);
boolean input = true;
String n = "";
while(input)
{
System.out.println("Enter a number");
int num = sc.nextInt();
if(num!=42)
n += num+" ";
else
input = false;
}
String numbers[] = n.split(" ");
for(String a: numbers)
System.out.println(a);
}
}
I submitted this with the option of JAVA (Hotspot) when asked for language. A compilation error occured thought this program works fine for me on BLUE J (JAVA IDE I use)
Can someone help me out ?