网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

下面的程序是打印输出100~300之间的不能被3整除的数。请在每条横线处填写一条语句,使程序的功能完整。

注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填人适当的语句。

public class printNo3and5{

void print()

{

int n ;

for(n=100 ;n<=300 ;n++){

if(n%3==0)

__________

System.out.println(n);

}

}

public static__________main(String args[])

{

printNo3and5 bj=new printN03and5();

__________

}

}


参考答案

更多 “ 下面的程序是打印输出100~300之间的不能被3整除的数。请在每条横线处填写一条语句,使程序的功能完整。注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填人适当的语句。public class printNo3and5{void print(){int n ;for(n=100 ;n=300 ;n++){if(n%3==0)__________System.out.println(n);}}public static__________main(String args[]){printNo3and5 bj=new printN03and5();__________}} ” 相关考题
考题 最大真约数是指一个数的(除它本身之外)最大约数。下面的程序是求一个数的最大真约数,请在程序的每条横线处填写一个语句,使程序的功能完整(例如:100的最大真约数是50)。注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。public class MaxDiv{public static void main(String args[ ]){int a=100;______________while(i0){if(____________________)_____________________i--;}System. out. print in (a+"的最大真约数为: "+i );}}

考题 接口是抽象方法和常量的集合,是一种特殊的抽象类。下面的程序是对接口的操作,请在程序的每条横线处填写一个语句,使程序的功能完整。注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。______________MyInterface{public static int NUM=100;public abstract void print();}public class ClassName___________MyInterface{public void print(){System.out.println(NUM);}public static void main(String args[]){__________________________obj .print();}}

考题 下面的程序是10000以内的“相亲数”。所谓相亲数是指这样的一对数:甲数的约数之和等于乙数,而乙数的约数等于甲数,(例如220和284是一对相亲数)请在程序的每条横线处填写一条语句,使程序的功能完整。注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。public class QinShu{public static void main(String args[ ]){for(int n=1;n<9999;n++){int s=divsum(n);if( )System.out.println(n+","+s);}}public static int divsum(int n){//该方法的功能是求一个数的所有约数int s=0;for(int i=1;____________________i++)if(____________________)s+=i;return s;}}

考题 下面的程序是用do-while语句计算10的阶乘。请在程序的每条横线处填写1个语句,使程序的功能完整。注意:请勿改动main()主方法和其他已有的语句内容;仅在横线处填入适当的语句。源程序文件代码清单如下:public class DoWhileLoop{public static void main(______){int n=10;long result=1;do{_____;}_____;System.out.println("10的阶乘为:"+result);}}

考题 下面的程序的功能是简单的进行键盘输入测试,请在程序的每条横线处填写一个语句,使程序的功能完整。注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。____________________public class TestKeyBoardInPut{public static void main(String[] args){String yourname=JOptionPane. ____________________ ("What is your name?");System.out.println("Hello"+yourname);____________________.exit(0);}}

考题 下面的程序的功能是求1~100的奇数的和及该和的平均值。请在程序的每条横线处填写一个语句,程序的功能完整。注意:请勿改动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);}}

考题 下面的程序是用do_while语句计算10的阶乘。请在程序的每条横线处填写一个语句,使程序的功能完整。注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。源程序文件代码清单如下:public class DoWhileLoop{public static void main(________){int n=10;long result=1;do{_______________}______________System.out.println("10的阶乘为: "+result);}}

考题 下面的程序的功能是求1~100的奇数的和及该和的平均值。请在程序的每条横线处填写一个语句,使程序的功能完整。注意:请勿改动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);}}

考题 下面的程序是求字符串的长度及每一个位置上的字符。请在每条横线处填写一条语句,使程序的功能完整。注意;请勿改动main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。public class CharAtOp{public static void main(String args[ ]){String str="abcdef";int size=System.out.println("字符串str的长度为: "+size);for(int m=0;___________________m++){_______________________System.out.println("str中的第"+m+"个字符是: "+c);}}}