Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

[Java] I get told I need to put my program in a file with the same name as my class?

$
0
0

So the algorithm I tried to submit for asks that I make a program where the user submits input, and that is given as out put. The program stops when "42" os passed. I wrote and tested the program, but when I submit here I get an error that the program needs to be in a file with the same name as the class, even when I submit it as a properly named file. How should I proceed? Thanks.

File name CheckingAccount.java ` import java.util.Scanner;

public class CheckingAccount {
public static void main(String args[]) {
   int input= 0;
    while(input != 42) {
        Scanner reader = new Scanner(System.in);
        input = reader.nextInt();
        boolean nani = false;

        System.out.println(input);
    }
    }
}`

Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>