- 0
- 0
- 约1.3万字
- 约 35页
- 2018-02-14 发布于浙江
- 举报
[所有分类]墨尔本大学java课程课件chap13
* * * * * * * * * * * * * * * * * * GeneralizedSelectionSort class: sort Method 13-* Copyright ? 2010 Pearson Addison-Wesley. All rights reserved. GeneralizedSelectionSort class: interchange Method 13-* Copyright ? 2010 Pearson Addison-Wesley. All rights reserved. Sorting Arrays of Comparable 13-* Copyright ? 2010 Pearson Addison-Wesley. All rights reserved. Sorting Arrays of Comparable 13-* Copyright ? 2010 Pearson Addison-Wesley. All rights reserved. Sorting Arrays of Comparable 13-* Copyright ? 2010 Pearson Addison-Wesley. All rights reserved. Defined Constants in Interfaces An interface can contain defined constants in addition to or instead of method headings Any variables defined in an interface must be public, static, and final Because this is understood, Java allows these modifiers to be omitted Any class that implements the interface has access to these defined constants 13-* Copyright ? 2010 Pearson Addison-Wesley. All rights reserved. Pitfall: Inconsistent Interfaces In Java, a class can have only one base class This prevents any inconsistencies arising from different definitions having the same method heading In addition, a class may implement any number of interfaces Since interfaces do not have method bodies, the above problem cannot arise However, there are other types of inconsistencies that can arise 13-* Copyright ? 2010 Pearson Addison-Wesley. All rights reserved. Pitfall: Inconsistent Interfaces When a class implements two interfaces: One type of inconsistency will occur if the interfaces have constants with the same name, but with different values Another type of inconsistency will occur if the interfaces contain methods with the same name but different return types If a class definition implements two inconsistent interfaces, then that is an error, and the class definition is illegal 13-* Copyright ? 2010 Pearson Addison-Wesley. All rights reserved. The Serializable Interface An extreme but commonly used example of an interface is the Serial
您可能关注的文档
最近下载
- 2026年春苏教版科学二年级下册教学工作计划.docx VIP
- 自动驾驶汽车技术架构.docx
- 《工业机器人离线编程与仿真(ABB)》 项目六 创建带导轨与变位机的工业机器人系统.pptx
- 新年开工教师师德教育课件 PPT.pptx
- 2025年法检系统书记员招聘考试(申论)参考题库含答案详解.docx VIP
- 中外教育简史教学课件全书ppt完整版课件整本书电子教案最全教学教程.pptx
- 数控设备维护与维修 (初级)课件.pptx
- 2026年湘中幼儿师范高等专科学校单招职业适应性测试题库完美版.docx VIP
- 标准图集-02J331地沟及盖板.pdf VIP
- 2026年湖南商务职业技术学院单招《数学》预测复习(精练)附答案详解.docx VIP
原创力文档

文档评论(0)