当前位置: 技术问答>java相关
我是java新手,请看下面这个程序中goal是什么东东?为什么没有定义还能够执行啊?
来源: 互联网 发布时间:2015-07-29
本文导语: import javax.swing.*; public class Retirement { public static void main(String args[]) { String input=JOptionPane.showInputDialog("How much money do you need to retire?"); double goal=Double.parseDouble(input); input=JOptionPane.showInputDialog("How muc...
import javax.swing.*;
public class Retirement
{
public static void main(String args[])
{
String input=JOptionPane.showInputDialog("How much money do you need to retire?");
double goal=Double.parseDouble(input);
input=JOptionPane.showInputDialog("How much money will you contribute every year?");
double payment=Double.parseDouble(input);
input=JOptionPane.showInputDialog("Interest rate in %:");
double interestRate=Double.parseDouble(input);
double balance=0;
int years=0;
while (balance
public class Retirement
{
public static void main(String args[])
{
String input=JOptionPane.showInputDialog("How much money do you need to retire?");
double goal=Double.parseDouble(input);
input=JOptionPane.showInputDialog("How much money will you contribute every year?");
double payment=Double.parseDouble(input);
input=JOptionPane.showInputDialog("Interest rate in %:");
double interestRate=Double.parseDouble(input);
double balance=0;
int years=0;
while (balance