注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。
源程序文件代码清单如下:
public class DoWhileLoop
{
public static void main(________)
{
int n=10;
long result=1;
do
{
_______________
}
______________
System.out.println("10的阶乘为: "+result);
}
}
第1题
注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。
源程序文件代码清单如下:
public class DoWhileLoop
{
public static void main(________)
{
int n=10;
long result=1;
do
{
_______________
}
______________
System.out.println("10的阶乘为: "+result);
}
}
第2题
注意:请勿改动main()主方法和其他已有的语句内容;仅在横线处填入适当的语句。
源程序文件代码清单如下:
public class DoWhileLoop
{
public static void main(______)
{
int n=10;
long result=1;
do
{
_____;
}
_____;
System.out.println("10的阶乘为:"+result);
}
}
第3题
下面是关于字符界面基本输入输出的程序,请在程序的每条横线处填写一个语句,使程序的功能完整。
注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。
______________________
public class SimpleCharInOut{
public static void main(String args[]){
char c=" ";
System.out.println("Enter a character please: ");
try{
____________________//接受用户键盘输入的字符并保存在变量c中
}
catch(________________________e){}
System.out.println("You've entered character "+c);
}
}
第4题
第5题
下面程序执行后,输出结果为:true请在程序的每条横线处填写一个语句,使程序的功能完整。
注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。
public class TestStringCompare{
{public static void main(String ____________________ args)
{char charl[]={'t','e','s','t'};
char char2[]={'t','e','s','t','1'};
String str1=new String(___________________);
String str2=new String(char2,0,4);
System.out.println(__________________________);
}
}
第6题
注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。
____________________
public class TestKeyBoardInPut
{public static void main(String[] args)
{String yourname=JOptionPane. ____________________ ("What is your name?");
System.out.println("Hello"+yourname);
____________________.exit(0);
}
}
第7题
第8题
第9题
第10题
注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。
public class SumAndAve{
public static void main(String args[]){
int count = 0, sum = 0, ave= 0;
for (int i = 1; i<= 100; ______)
if(______)
continue;
else
{
______
sum=sum+i;
}
ave= sum/count;
System.out.println("sum="+sum);
System.out.println("ave="+ave);
}
}
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!