最赞回答 / 慕先生5405824
你所有的System.out.println()中的()用的都是中文(),换成英文的()就对了。
exp{ (String[] args) { one = ; two = ; three = ; three = one + two...
2023-11-13
public class HelloWorld {
public static void main(String[] args) {
int age=25;
if(age>=18){
System.out.println("成年");
}else{
System.out.println("未成年");
}
// 条件运算符方法2
// String age2=(age>=18)?"成年":"未成年";
// System.out.println(age2);
}
}
public static void main(String[] args) {
int age=25;
if(age>=18){
System.out.println("成年");
}else{
System.out.println("未成年");
}
// 条件运算符方法2
// String age2=(age>=18)?"成年":"未成年";
// System.out.println(age2);
}
}
2023-10-23
public class HelloWorld {
public static void main(String[] args) {
int age=25;
String age2=(age>=18)?"成年":"未成年";
System.out.println(age2);
}
}
public static void main(String[] args) {
int age=25;
String age2=(age>=18)?"成年":"未成年";
System.out.println(age2);
}
}
2023-10-23
在 IDEA 中,try-catch 可由快捷键生成,方法如下:
1. 选择想要被 try-catch 包围的语句;
2. 按键盘上 CTRL +ALT + t 快捷键;
1. 选择想要被 try-catch 包围的语句;
2. 按键盘上 CTRL +ALT + t 快捷键;
2023-09-25
public class HelloWorld{
public static void main(String[] args){
int num = 1999;
int count = String.valueOf(Math.abs(num)).length();
for(int i = 0; i < 10; i++){
if(i == count){
System.out.print(num + "是" + i + "位数");
}
}
}
}
public static void main(String[] args){
int num = 1999;
int count = String.valueOf(Math.abs(num)).length();
for(int i = 0; i < 10; i++){
if(i == count){
System.out.print(num + "是" + i + "位数");
}
}
}
}