皮皮学,免费搜题
登录
logo - 刷刷题
搜题
【简答题】
在水果盘(Plate)中有一些水果,如苹果(Apple)、香蕉(Banana)、梨子(Pear),当然大水果盘中还可以有小水果盘,现需要对盘中的水果进行遍历(吃),当然如果对一个水果盘执行“吃”方法,实际上就是吃其中的水果。使用( 1 )模式模拟该场景。 public abstract class 2 { public abstract void eat(); } public class Pear extends MyElement { public void eat() { System.out.println(" 吃梨子! "); } } public class Banana extends MyElement { public void eat() { System.out.println(" 吃香蕉! "); } } public class Apple extends MyElement { public void eat() { System.out.println(" 吃苹果! "); } } import java.util.*; public class Plate extends MyElement { private ArrayList list=new ArrayList(); public void add( 3 ) { list.add(element); } public void delete(MyElement element) { 4 ; } public void eat() { for(Object object:list) { 5 ; } } } public class Client { public static void main(String a[]) { MyElement obj1,obj2,obj3,obj4,obj5; Plate plate1,plate2,plate3; obj1=new Apple(); obj2=new Pear(); plate1=new Plate(); plate1.add(obj1); plate1.add(obj2); obj3=new Banana(); obj4=new Banana(); plate2=new Plate(); plate2.add(obj3); plate2.add(obj4); obj5=new Apple(); plate3=new Plate(); plate3.add(plate1); plate3.add(plate2); plate3.add(obj5); plate3.eat(); } }
手机使用
分享
复制链接
新浪微博
分享QQ
微信扫一扫
微信内点击右上角“…”即可分享
反馈
参考答案:
举一反三
【简答题】A young woman was diagnosed with a terminal illness(不治之症)and given three months to live. So as she was getting her things “in order”, she asked her pastor(牧师)to come to her house to discuss her final ...
【判断题】绝热过程的n=k
A.
正确
B.
错误
【判断题】阴极保护是使电位移向负方,处于稳定区而不受腐蚀。
A.
正确
B.
错误
【简答题】以下过程的指数分别是多少? (1)定压过程,n=_______ (2)定容过程, n=_______ (3)定温过程, n=_______ (4)绝热过程, n=_______
【多选题】You need to design the configuration on one Windows Server 2003 terminal server that hosts the SalesForceMax application to meet security requirements. Which three actions should you take?()
A.
Configure the terminal server so that users log on by using local user accounts
B.
Configure the terminal server so that users log on by using domain accounts
C.
Configure the server to run SalesForceMax in a dedicated window when a user logs on to the terminal server
D.
Configure the server to allow each user to have a Windows desktop when the user logs on to the terminal server
E.
Use software restriction polices in Group Policy objects (GPOs) that apply to the terminal server
F.
Use Appsec.exe to restrict applications on the terminal server
【单选题】Transistors are three-terminal used as amplifiers and as switches.
A.
components
B.
devices
C.
elements
【单选题】2mol的单原子理想气体,其绝热过程的△(pV)=-26kJ,则该过程的体积功W= 。
A.
26kJ
B.
-65kJ
C.
39kJ
D.
-39kJ
【判断题】在《皇帝的新装》中最后是一个孩子说出了皇帝实际上什么也没穿的事实! ( )
A.
正确
B.
错误
【单选题】(2007年)压气机最理想的压缩过程是采用( )。
A.
n=k的绝热压缩过程
B.
n=1的定温压缩过程
C.
1<n<k的多变压缩过程
D.
n>k的多变压缩过程
【单选题】绝热 过程 中,热力系统 的多变指数 n= 。
A.
1
B.
0
C.
k
D.
相关题目:
参考解析:
知识点:
题目纠错 0
发布
创建自己的小题库 - 刷刷题