Diaby does Gallas
August 22nd, 2010, 03:03 PM
I am trying to run this basic bit of code in JCreator which I have got from thenewboston:
import java.util.Scanner;
class Building a Basic Calculator 7 {
public static void main(String args[]){
Scanner anthony = new Scanner(System.in);
double fnum, snum, answer; //fnum mean first num, snum mean second num
System.out.println("Enter first num: ");
fnum = anthony.nextdouble();
System.out.println("Enter second num: ");
snum = anthony.nextDouble();
answer = fnum + snum;
System.out.println(answer);
}
}
I have done everything that was asked but when I compile the program I get an error saying that a '}' is required on linne 3, and if I try to run the program it just says that the system couldn't find a suitable main method, can you please tell me where I may be going wrong?
import java.util.Scanner;
class Building a Basic Calculator 7 {
public static void main(String args[]){
Scanner anthony = new Scanner(System.in);
double fnum, snum, answer; //fnum mean first num, snum mean second num
System.out.println("Enter first num: ");
fnum = anthony.nextdouble();
System.out.println("Enter second num: ");
snum = anthony.nextDouble();
answer = fnum + snum;
System.out.println(answer);
}
}
I have done everything that was asked but when I compile the program I get an error saying that a '}' is required on linne 3, and if I try to run the program it just says that the system couldn't find a suitable main method, can you please tell me where I may be going wrong?