Java 程序无法启动,取款/存款方法

Java 程序无法启动,取款/存款方法,java,class,methods,main,Java,Class,Methods,Main,我不熟悉方法和类。 我编写了一个取款/存款程序,要求输入姓名和余额,允许取款和存款功能。eclipse不允许我运行程序,为什么会这样??我是否要在单独的类上创建公共静态void主字符串[]args??如果有必要的话,有什么方法可以让我留在这个班上或者转到主班 import java.util.Scanner; public class bank { private String name; private double balance; private double withdraw; pri

我不熟悉方法和类。 我编写了一个取款/存款程序,要求输入姓名和余额,允许取款和存款功能。eclipse不允许我运行程序,为什么会这样??我是否要在单独的类上创建公共静态void主字符串[]args??如果有必要的话,有什么方法可以让我留在这个班上或者转到主班

import java.util.Scanner;

public class bank {
private String name;
private double balance;
private double withdraw;
private double deposit;
private double withdrawTotal;
private double depositTotal;

bank()
{
    name = null;
    balance = 0;        
    withdraw = 0;
    deposit = 0;
    withdrawTotal = 0;
    depositTotal = 0;

}   

public String getname() {
    return name;
}

public double getBalance(){
    return balance;
}

//public double getAnnualInterestRate(){
    //return annualInterestRate;
//}

public double getWithdraw() {
    return withdraw;
}

public double getDeposit() {
    return deposit;
}

public double getWithdrawTotal() {
    return withdrawTotal;
}

public double getDepositTotal() {
    return depositTotal;
}

public void setname(String newname){
    Scanner namescan = new Scanner(System.in);
    name = namescan.nextLine();
}

public void setBalance(double newBalance){
    Scanner bscan = new Scanner(System.in);
    balance = bscan.nextInt();
}


public void setWithdraw(double newWithdraw){
    withdraw = newWithdraw;
}

public void setDeposit(double newDeposit){
    deposit = newDeposit;
}

public void setWithdrawTotal(double newWithdrawTotal){
    deposit = newWithdrawTotal;
}

public void setDepositTotal(double newDepositTotal){
    deposit = newDepositTotal;
}


   //calculate method

public double withdrawCalculuation() {
    return balance - withdraw;
}

public double depositCalculation(){
    return balance + deposit;
}

//public double annualInterestRateCalculation(){
//  return depositTotal * .045;
//}


public void print() {
bank account = new bank();
account.setname(name);
account.setBalance(20000.00);
account.setWithdraw(2500);
account.setWithdrawTotal(17500.00);
account.setDeposit(3000.00);
account.setDepositTotal(20500.00);
//account.setAnnualInterestRate(.045);


System.out.println("The Accound name is:" + account.getname());
System.out.println("The Balance is:" + account.getBalance());
System.out.println("Amount of withdrawal is:" + account.getWithdraw());
System.out.println("The Balance after withdrawal is:" + account.getWithdrawTotal());
System.out.println("Amount of deposit is:" + account.getDeposit());
System.out.println("The Balance after depsoit is:" + account.getDepositTotal());
//System.out.println("The monthly interest for total amount is:" + account.getAnnualInterestRate());
}



}

请从基本的Java开始。您需要有一个主方法来执行java程序。

eclipse不允许我运行该程序,为什么会这样

因为JVM无法找到main方法

我是否要在单独的类上创建公共静态void主字符串[]args

不可以。您可以在同一个类中添加主