- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
Declaring Classes [modifiers]class ClassName[extends Father-ClassName] [implements InterfaceName[,InterfaceName] ] Modifiers public abstract final The class name Superclass Interfaces The class body {}. Eg: public final class String public abstract class AbstractSetE extends AbstractCollectionE implements SetE Quiz: Check the following statements, see if there is error: final abstract class Class1{} final public class Class2{} Final class Class3{} class Class4 extends Class3{} Abstract class Class5{} Class5 myClass=new Class5 Declaring Member Variables fields There are three kinds of variables: fields:Member variables in a class local variables:Variables in a method or block of code parameters:Variables in method declarations Field declarations are composed of three components modifiers :access modifiers;static;final type. name. Defining Methods Modifiers Access modifiers static final Abstract: abstract returnType name ([parameterList]){} The return type The method name The parameter list in parenthesis An exception list The method body, enclosed between braces Local variable Type name = initialValue; statements Providing Constructors for Your Classes Be invoked to create objects from the class blueprint Definition signature is the same as a mothod. Name after the class Without return type Caution new One class can have more than one constructor only with different parameter lists One is allowed to provide with no constructor under the following conditions With implicity super class Object With super class which has an construtor accept no parameters class Super{ int i; public Super(int i){ this.i=i; } } class Son extends Super{ void show(){System.out.println(i);} public static void main(String args[]){ Son s=new Son(); s.show(); } } class Super{ int i; public Super(){ this.i=0; } public Super(int i){ this.i=i; } } class Son extends Super{ void show(){System.out.println(i);} public static void main(String args[]){
您可能关注的文档
最近下载
- [宜昌]2024年湖北宜昌市直部分事业单位招聘随军家属12人笔试历年参考题库(频考点试卷)解题思路附.docx VIP
- 第二章能带的理论.ppt VIP
- CMK公式(设备能力指数EXCEL自动计算).xlsx VIP
- SYT 5735-2019- 烃源岩地球化学评价方法.pdf VIP
- 液压与气压传动 第2版 教学课件 作者 马振福 高职课件11.ppt VIP
- 大金模块机操作安装维护指导手册最新.pdf VIP
- 线路参数测试方案.docx VIP
- 肩袖损伤康复 ppt课件.pptx
- 2021爆炸性环境 爆炸预防和防护第1部分基本原则和方法.pdf VIP
- 液压与气压传动第2版试卷马振福主编高职课件12课件.ppt VIP
文档评论(0)