import java.io.*; class Person{ public void print(){System.out.print("Person ");} public void printMyGender(String s){ this.print(); System.out.print(s+" "); } } class Gender{ String type="gender"; public void print(Person p){p.printMyGender(type);} } class Female extends Gender{ public Female(){ type="female"; } } class Male extends Gender{ public Male(){ type="male"; } } class Employee extends Person{ public void print(){ System.out.print("Employee ");} } class Manager extends Employee{ public void print(){ System.out.print("Manager ");} } public class Test{ public static void main(String[] args){ Manager man = new Manager(); Employee em = new Employee(); Gender gender1 = new Male(); Gender gender2 = new Female(); gender1.print(man); gender2.print(em); } } 对于以上代码,其运行结果是
import java.io.*; class Person{ public void print(){System.out.print("Person ");} public void printMyGender(String s){ this.print(); System.out.print(s+" "); } } class Gender{ String type="gender"; public void print(Person p){p.printMyGender(type);} } class Female extends Gender{ public Female(){ type="female"; } } class Male extends Gender{ public Male(){ type="male"; } } class Employee extends Person{ public void print(){ System.out.print("Employee ");} } class Manager extends Employee{ public void print(){ System.out.print("Manager ");} } public class Test{ public static void main(String[] args){ Manager man = new Manager(); Employee em = new Employee(); Gender gender1 = new Male(); Gender gender2 = new Female(); gender1.print(man); gender2.print(em); } } 对于以上代码,其运行结果是
import java.io.*;</p></p> class Person{</p></p> public void print(){System.out.print("Person ");}</p></p> public void printMyGender(String s){</p></p> this.print();</p></p> System.out.print(s+" ");</p></p> }</p></p> }</p></p> class Gender{</p></p> String type="gender";</p></p> public void print(Person p){p.printMyGender(type);}</p></p> }</p></p> class Female extends Gender{</p></p> public Female(){</p></p> type="female";</p></p> }</p></p> }</p></p> class Male extends Gender{</p></p> public Male(){</p></p> type="male";</p></p> }</p></p> }</p></p> class Employee extends Person{</p></p> public void print(){</p></p> System.out.print("Employee ");}</p></p> }</p></p> class Manager extends Employee{</p></p> public void print(){</p></p> System.out.print("Manager ");}</p></p> }</p></p> public class Test{</p></p> public static void main(String[] args){</p></p> Manager man = new Manager();</p></p> Employee em = new Employee();</p></p> Gender gender1 = new Male();</p></p> Gender gender2 = new Female();</p></p> gender1.print(man);</p></p> gender2.print(em);</p></p> }</p></p> }</p></p> 对于以上代码,其运行结果是</p></p>
import java.io.*;</p></p> class Person{</p></p> public void print(){System.out.print("Person ");}</p></p> public void printMyGender(String s){</p></p> this.print();</p></p> System.out.print(s+" ");</p></p> }</p></p> }</p></p> class Gender{</p></p> String type="gender";</p></p> public void print(Person p){p.printMyGender(type);}</p></p> }</p></p> class Female extends Gender{</p></p> public Female(){</p></p> type="female";</p></p> }</p></p> }</p></p> class Male extends Gender{</p></p> public Male(){</p></p> type="male";</p></p> }</p></p> }</p></p> class Employee extends Person{</p></p> public void print(){</p></p> System.out.print("Employee ");}</p></p> }</p></p> class Manager extends Employee{</p></p> public void print(){</p></p> System.out.print("Manager ");}</p></p> }</p></p> public class Test{</p></p> public static void main(String[] args){</p></p> Manager man = new Manager();</p></p> Employee em = new Employee();</p></p> Gender gender1 = new Male();</p></p> Gender gender2 = new Female();</p></p> gender1.print(man);</p></p> gender2.print(em);</p></p> }</p></p> }</p></p> 对于以上代码,其运行结果是</p></p>
【单选题】下面的if语句统计满足“性别(gender)为男、职称(rank)为教授、年龄(age)小于40岁”条件的人数,正确的语句为 (2.0分) A. if (gender=="男" or age<40 and rank="教授"): n+=1 B. if (gender=="男" and age<40 and rank="教授"): n+=1 C. if (gender=="男" and age<40 or rank="教授"): n+=1 D. if (gender=="男" or age<40 and or="教授"): n+=1
【单选题】下面的if语句统计满足“性别(gender)为男、职称(rank)为教授、年龄(age)小于40岁”条件的人数,正确的语句为 (2.0分) A. if (gender=="男" or age<40 and rank="教授"): n+=1 B. if (gender=="男" and age<40 and rank="教授"): n+=1 C. if (gender=="男" and age<40 or rank="教授"): n+=1 D. if (gender=="男" or age<40 and or="教授"): n+=1
下面if语句统计“成绩(mark)优秀(90分以上)的男生以及不及格(60以下)的男生”的人数,正确的语句为( )。 A: if(gender=="男")and((mark<60)and(mark>=90)):n+=1 B: if(gender=="男")and((mark<60)or(mark>=90)):n+=1 C: if(gender=="男")or(mark<60)or(mark>=90)):n+=1 D: if(gender=="男")or(mark<60)and(mark>=90):n+=1
下面if语句统计“成绩(mark)优秀(90分以上)的男生以及不及格(60以下)的男生”的人数,正确的语句为( )。 A: if(gender=="男")and((mark<60)and(mark>=90)):n+=1 B: if(gender=="男")and((mark<60)or(mark>=90)):n+=1 C: if(gender=="男")or(mark<60)or(mark>=90)):n+=1 D: if(gender=="男")or(mark<60)and(mark>=90):n+=1
下面用if语句统计“成绩(score)优秀的男生以及不及格的男生”的人数,正确的语句为_____。 A: if(gender=="男" and score <60 or score>=90): n+ = 1 B: if(gender=="男" and score <60 and score>=90): n+ = 1 C: if(gender=="男" and (score <60 or score>=90)): n+ = 1 D: if(gender=="男" or score <60 or score>=90): n+ = 1
下面用if语句统计“成绩(score)优秀的男生以及不及格的男生”的人数,正确的语句为_____。 A: if(gender=="男" and score <60 or score>=90): n+ = 1 B: if(gender=="男" and score <60 and score>=90): n+ = 1 C: if(gender=="男" and (score <60 or score>=90)): n+ = 1 D: if(gender=="男" or score <60 or score>=90): n+ = 1
【其它】写出并理解下列语句输出的结果 s = "hello" print(s[0]) print(s[4]) print(s[-1]) print(s[0:3]) print(s[0:4:2]) print(s[:]) print(s[:3]) print(s[::-1]) print(s[1:])
【其它】写出并理解下列语句输出的结果 s = "hello" print(s[0]) print(s[4]) print(s[-1]) print(s[0:3]) print(s[0:4:2]) print(s[:]) print(s[:3]) print(s[::-1]) print(s[1:])
运行下列代码段,输出结果中包含1的是( )。 A: while True:print(1) B: while False:print(1) C: while 1:print(1) D: while 0:print(1)
运行下列代码段,输出结果中包含1的是( )。 A: while True:print(1) B: while False:print(1) C: while 1:print(1) D: while 0:print(1)
下列Python代码,函数的定义和调用书写正确的是() A: def test(a| b): print(a) print(b) test(1| 2) B: def test(a): print(a) print(b) test(1, 2) C: def test(a, b): print(a) print(b) test(1) D: def test(a, b): print(a) print(b) test(1, 2)
下列Python代码,函数的定义和调用书写正确的是() A: def test(a| b): print(a) print(b) test(1| 2) B: def test(a): print(a) print(b) test(1, 2) C: def test(a, b): print(a) print(b) test(1) D: def test(a, b): print(a) print(b) test(1, 2)
Python语言中,以下表达式输出结果为11的选项是 A: print(eval("1"<br/>+ "1")) B: print(eval("1"<br/>+ 1)) C: print(1+1) D: print(eval("1+1"))
Python语言中,以下表达式输出结果为11的选项是 A: print(eval("1"<br/>+ "1")) B: print(eval("1"<br/>+ 1)) C: print(1+1) D: print(eval("1+1"))
Print #1,STR$中的Print是()。
Print #1,STR$中的Print是()。