应该使用do......while吧,do{count++;num/=10;}while(num!=0)
不然当num=0时,返回结果回事输入错误
不然当num=0时,返回结果回事输入错误
public class HelloWorld{
public static void main(String[] args) {
string hobby1="我爱慕课网";
string hobby2="www.imooc.com";
System.out.println(hobby1);
System.out.println(hobby2);
}
}
哪里出错
public static void main(String[] args) {
string hobby1="我爱慕课网";
string hobby2="www.imooc.com";
System.out.println(hobby1);
System.out.println(hobby2);
}
}
哪里出错
2021-11-21
现在IDEA很好了,集成了jdk自动下载, 就是你只需要下载idea,然后可以在IDEA里面下载JDK自动安装,环境配置什么都不用搞
2021-11-19
int cj=new Scanner(System.in).nextInt();
String xb=new Scanner(System.in).next();
if(cj>=80){
if(xb.equals("女")){
System.out.println("进入女子决赛组");
}else{
System.out.println("进入男子决赛组");
}
}else{
System.out.println("淘汰");
}
String xb=new Scanner(System.in).next();
if(cj>=80){
if(xb.equals("女")){
System.out.println("进入女子决赛组");
}else{
System.out.println("进入男子决赛组");
}
}else{
System.out.println("淘汰");
}
2021-11-10
System.out.print("请输入年龄:");
int m=new Scanner(System.in).nextInt();
if(m<18){
System.out.println("少年");}else if(m<30){
System.out.println("青年");}else if(m<55){
System.out.println("中年");}else{
System.out.println("老年");}
int m=new Scanner(System.in).nextInt();
if(m<18){
System.out.println("少年");}else if(m<30){
System.out.println("青年");}else if(m<55){
System.out.println("中年");}else{
System.out.println("老年");}
2021-11-10
System.out.print("请输入年龄:");
int m=new Scanner(System.in).nextInt();
if(m<18){
System.out.println("未成年");}else{
System.out.println("成年");}
int m=new Scanner(System.in).nextInt();
if(m<18){
System.out.println("未成年");}else{
System.out.println("成年");}
2021-11-10
System.out.print("请输入数字:");
int m=new Scanner(System.in).nextInt();
if(m%2==0){
System.out.println("偶数");}else{
System.out.println("单数");}
int m=new Scanner(System.in).nextInt();
if(m%2==0){
System.out.println("偶数");}else{
System.out.println("单数");}
2021-11-10