- 1、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
Java面向对象程设计测试试卷
阅读下面的程序代码,写出运行结果。 7*10 70分
1、//Person.java
public class Person String song;
String sport;
void sing System.out.print My favarate song is+ song ; void doSport System.out.print My favarate sport is+ sport ; public static void main String[] args Person p1 new Person ;
p1.song pop music;
p1.sing ; 2. //Test1.java
public class Test1 public static void main String[] args StaticA.f ;
new StaticA .f ; class StaticA static int count 4 ;
public static void f System.out.println count++ ; 3. //Test2.java
public class Test2 Test2 System.out.println Constructor Test2 is executed . ; Test2 int i this ;
System.out.println Constructor Test2 int i is executed . ; public static void main String[] args new Test2 2 ; 4. //Test3.java
public class Test3 public static void main String[] args new A .A ; class A A System.out.println Constructor A ; void A System.out.println Method A ; 5.public class Shape float getArea float r return 3.14f*r*r; int getArea int a,int b return a*b; double getArea double a,double b return a*b; double getArea int a,int b,int c if a+b c||a+c b ||b+c a double p 1/2* a+b+c ;
return Math.sqrt p* p-a * p-b * p-c ; else
return 0; public static void main String args[] Shape square new Shape ;
System.out.println square.getArea 3,4 ;
Shape round new Shape ;
System.out.println round.getArea 3 ;
Shape tri new Shape ;
System.out.println tri.getArea 3,4,5 ; 6. // Test5.java
public class Test5 public static void main String[] args new S ; class P P System.out.println Constructor P ; class S extends P S System.out.println Construtor S ; 7. // Test7.java
public class Test7 public static void main String[] args Test7 t new Test7 ;
t.f ;
t.f 3.0, 4.0 ;
t.f false ; private void f boolean b System.out.println Method f boolean is executed . ; private void f double d, double e System.out.println Method f double d, double e is executed . ; private void f int i this.f ; private void f System.out.println Method f is executed
您可能关注的文档
最近下载
- 《农业废弃物资源化利用》课件.ppt VIP
- 冷却塔运行记录表.docx VIP
- 2025湖北省监督数据分析应用中心专项招聘22人笔试备考试题及答案解析.docx VIP
- 《农业废弃物资源化利用》课件.ppt VIP
- 2025年湖北省监督数据分析应用中心专项公开招聘22名工作人员笔试备考题库及答案解析.docx VIP
- 外研版高中《英语》(新标准)必修二Unit4 单元整体教学设计附作业设计.docx VIP
- 初中物理教研会记录(3篇).docx VIP
- 中医诊疗器具消毒课件必威体育精装版完整版本.pptx VIP
- 乘法公式.2乘法公式.ppt VIP
- 小兔子和小狐狸的100个睡前晚安小故事.docx VIP
文档评论(0)