急需要答案一道JAVA题的答案

2024-11-30 06:56:14
推荐回答(3个)
回答1:

public class Account {
private String name;
private double balance;

public Account(String name, double balance) {
super();
this.name = name;
this.balance = balance;
}
void deposite(double amount){
balance+=amount;
}
public String getName() {
return name;
}

public double getBalance() {
return balance;
}
}

import java.util.Scanner;

public class aa {

/**
* @param args
* @throws IOException
* @throws NumberFormatException
*/
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Account account=new Account("张华", 0);
account.deposite(100);
System.out.print("账户名:"+account.getName()+",账户余额为:"+account.getBalance());
}
}

回答2:

这样的问题也好意思提问。是不是和马士兵哪里学来的啊 。误人子弟。

回答3:

作业题,不回答