我进行了一些调试作业,但似乎无法运行代码……Java 的新手,希望得到任何反馈
public class Errors {
public static void main(String[] args) {
System.out.println("Welcome to my first program!\n");
String ageStr = "24 years";
int age = Integer.parseInt(ageStr);
System.out.println("I'm " + age + " years old.");
int three = "3";
int threeToString = Integer.parseInt(three);
int answerYears = age + three;
System.out.println("Toal number of years: " + answerYears);
int answerMonths = answerYears * 12;
System.out.println("In 3 years and 6 months, I'll be " + answerMonths + " months old");
// Once you've corrected all the errors, the answer should be 330.
}
}
繁星淼淼
相关分类