纯java新生学习第二天遇到问题求解答,是讲师留的assignment,感恩的心
问题1:
public class DebugTwo1
{
public static void main(String[] args)
{
int a = 315;
double b = 12.4;
System.out.print("The int is ");
System.out.println(int);
System.out.print("The double is ");
System.out.println(double);
}
}
int 和 double输出有问题
问题2:
```java
public class DebugTwo2
// This application performs arithmetic with two integers
{
public static void main(String args[])
{
int a, b;
7 = a;
4 = b;
System.out.println("The sum is '+ a + b'");
System.out.println("The difference is '+ a - b'");
System.out.println("The product is '+ a * b'");
}
}
错误提示7和4是变量
问题3:
public class DebugTwo3
// Demonstrates remainder and output
{
public static void main(String args[])
{
double a = 99, b = 8 ;
int c = 77;
result = a % b;
System.out.println("Divide " + a + " by " + b);
System.out.println("remainder is " + result);
System.out.print("c is a very large number:");
System.out.println(c);
}
}
result不能被解析为一个变量
在网上查了还是没看懂,求解,谢谢!~