第08行的print语句仅在num1大于num2时生效()
- · 有6位网友选择 错,占比75%
- · 有2位网友选择 对,占比25%
注意:请勿改动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();
}
}
【Ex-6-8】假设二叉树中每个结点值为单个字符,采用二叉链存储结构存储。下面算法的功能是:求二叉树b中第k层上叶子结点个数。请在空白处填入正确的语句。 int LevelkCount(BiTNode *b, int k, int h) { //h 的初值为 1 int num1, num2, num = ______①______; if (b != NULL) { if (_____②______ && b->lchild == NULL && b->rchild == NULL) _______③________; num1 = LevelkCount(b->lchild, k, h + 1); num2 = _________④_________; num += _________⑤_________; return num; } return 0; } int Levelkleft(BiTNode *b, int k ) { //返回二叉树 b 中第 k 层上叶子结点个数 return LevelkCount(b, k, 1); }
注意:请勿改动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();
__________
}
}
A、def product1(num): product=1 for i in range(1,num+1): product=product *i return product print(product1(10))
B、def sum1(num): sum2=0 for i in range(1,num+1): sum2+=i return sum2 print(sum1(100))
C、def product2(num): if num==1: return 1 else: return num *product2(num-1) print(product2(10))
D、def sum_a(num1): if num1==1: return 1 else: return num1+sum_a(num1-1) print(sum_a(100))
下列程序打包到example包,main方法调用线程类输出0~9这10个数,请填写横线处的内容。
注意:请勿改动main()主方法和其他已有语句内容,仅在横线处填入适当语句。
______
interface MyInterface
{
public abstract void print(int n);
}
class Mythread extends Thread ______ MyInterface
{
public void run()
{
for(int i = 0; i < 10; i++)
this.print(i);
}
public void print(int n)
{
System.out.print(n +" ");
}
}
public class Example1_6
{
public static void main(String argv[])
{
Mythread th = new Mythread();
______
}
}
注意:请勿改动main()主方法和其他已有语句内容,仅在下划线处填入适当的语句。
程序运行结果如下:
输入一个大写字母串:ADFSDFFE
加密后的大写字母串:ZWUHWUUV
import java.io.*;
public class ex12_2{
public static void main (String[] args){
char ch = 'A';
String str;
System. out .print ("输入一个大写字母串: ");
try{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
str= in.readLine();
System. out .print ("加密后的大写字母串:");
for(int i=0;i<str.length();i++){
_______________;
_______________;
System.out.print(ch);
}
}catch(IOException e){}
try{
System.in.read();
}catch(IOException e) {};
}
}
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!