why this java code is showing a runtime error.

import java.util.Scanner;
public class ATM{
public static void main(String[] args){
Scanner ip = new Scanner(System.in);
double bal = ip.nextDouble();
int amt = ip.nextInt();
else System.out.println(bal);

Doubt ; Y is it so? it is working on pc

The name of the class should be Main in java for all the submissions on CodeChef. Rename it to Main. Please don’t try different programming languages if it’s not getting accepted in one language. Try debugging the error to check for mistakes.

You are taking the inputs in reverse order. You need to input amt first and then bal. You need not make the class public.

Its not any compulsion of having class name as Main on Codechef.

@vinayawsm…if u declare the class as public…then it is a compulsion!!!

okey. I am sorry I didn’t know that.