package zh.codegym.task.task02.task0207;
/*
计算器的一部分
*/
public class Solution {
public static void main(String[] args) {
int a = 5;
int b = 7;
String c = 5 +7;
String d = 5 * 7;
System.out.print("c");
System.out.print("d");
}
}
请问是哪里出现了错误?
正在讨论
评论 (4)
- 受欢迎
- 新
- 旧
你必须先登录才能发表评论
Kwan
11 七月 2021, 05:34
//先理解数据类型,数据类型要一样,int为整数类型,String为字符串类型,就是: "a",类似加双引号的,输出为a。
0
AE86
2 七月 2020, 11:06
public class Solution {
public static void main(String[] args) {
//在此编写你的代码
int a =5;
int b =7;
System.out.println(a+b);
System.out.println(a*b);
}
}
0
Maygagako797308
16 六月 2020, 00:58
package zh.codegym.task.task02.task0207;
/*
计算器的一部分
*/
public class Solution {
public static void main(String[] args) {
int a = 5;
int b = 7;
int c = 5 +7;
int d = 5 * 7;
System.out.println(c);
System.out.println(d);
}
}
0
zimme
14 六月 2020, 05:40
int a=5 ;
int b=7; System.out.println(a+b); System.out.println(a*b);
String variables are defined within " " but certainly 5 + 7 within the string would be printed as 57 not 12. You could for example write int x = a + b; int y = a * b; anx then print them out.
Change System.out.print to System.out.println because print prints the results in one line and println in a new line
0