有了方法为什么还会出现:Selection does not contain a main type。求高人帮助
public class CompoundInterest{
public static void mian(String[] args)
{
final double STARTRATE = 10;
final int NRATES = 6;
final int NYEARS = 10;
//set interest rates to 10.....15
double[] interestRate = new double[NRATES];
for(int j=0; j<interestRate.length; j++)
interestRate[j] = (STARTRATE + j)/100.0;
double[][] balances = new double[NRATES][NYEARS];
//set initial balances to 10000
for(int j=0; j< balances[0].length; j++)
balances[0][j] = 10000;
// copute interest for future years
for(int i=1;i<balances.length; i++)
{
for(int j=0; j<balances[i].length; j++)
{
// get last year's balances from previous row
double oldBalance = balances[i-1][j];
// compute interest
double interest = oldBalance * interestRate[j];
// compute this year's balances
balances[i][j] = oldBalance + interest;
}
}
// print one row of interest rates
for(int j=0; j<interestRate.length; j++)
System.out.printf("%9.0f%%",100*interestRate[j]);
System.out.println();
// print balance table
for(double[] row: balances)
{
//print table row
for(double b: row)
System.out.printf("%10.2f",b);
System.out.println();
}
}
}
--------------------编程问答-------------------- public static void mian(String[] args)
public static void main(String[] args) --------------------编程问答-------------------- 想当年手打时也有过这种问题啊!! --------------------编程问答-------------------- 手动输入的 ?
不行就在创建class的时候 ,把main的选项也给带上 ,反正是测试类的 --------------------编程问答-------------------- main函数拼错了,如果手动写了,运行的时候报错,还是放到ide里面看看! --------------------编程问答-------------------- 谢谢各位都怪我粗心大意。 --------------------编程问答--------------------
这个方法可以的 不知道为什么手动输入的不认识
补充:Java , Java SE