当前位置: 首页 > news >正文

网站开发需要哪些技术人员网盟推广是什么意思

网站开发需要哪些技术人员,网盟推广是什么意思,如何做收机微网站,网站电脑版和手机版区别1、内部类:属于类的成员之一,类的内部又定义类,外层的class称为外部类,内部的class称为内部类。 设计了某个类,根据需求发现其内部又需要定义一个独立的内部结构,此时就考虑将其定义为内部类,内…

1、内部类:属于类的成员之一,类的内部又定义类,外层的class称为外部类,内部的class称为内部类。

设计了某个类,根据需求发现其内部又需要定义一个独立的内部结构,此时就考虑将其定义为内部类,内部类依赖于外部类,不可能独立存在。

举例:
    母亲 和其 腹中的胎儿

备注:外部类的权限修饰只能用public或者缺省,而内部类可以用所有的四种权限。

2、内部类的分类:

定义位置:

1)、成员内部类: 定义在类的成员位置;
2)、局部内部类: 定义在类的局部位置; 

成员内部类细分:

1)、非静态成员内部类:非静态内部类;
2)、静态成员内部类:  静态内部类;

局部内部类细分:

1)、局部内部类:    定义在局部位置的有名类;  
2)、匿名内部类:    定义在局部位置的匿名类;


1、匿名内部类:内部类中,匿名内部类使用率最高,所以这里先进行说明,其它的内部类直接后面放代码里进行说明。

引入场景:
    类/接口内部定义了某方法,我需要使用该方法,但是发现方法体的逻辑不适合,
    根据之前学习过的技术,我们就定义一个类,让该类去继承父类/实现接口,
    重写其内部的方法,在外界实例化对象,对象调用方法完成需求。

    【问题】:辛辛苦苦设计完一个类,但是在外界只需要使用很少的次数(比如:一次)
              那么有点浪费了!!!

    【解决】:可以使用匿名内部类解决上述的问题

格式:

两种情况:

情况一:和父类有关

模板:
    new 父类名(){
        //设计匿名子类的成员
    };

情况二:和接口有关

模板:
    new 接口名(){
        //设计匿名实现类的成员
    };

解析格式:
    
内部包含两个环节:

环节一:设计匿名子类/实现类
环节二:创建匿名子类/实现类的对象

备注:匿名内部类不能赋值给对象引用,要调用时只能匿名类自己直接在后面.操作进行调用方法,例如下面这样三个例子:

//匿名内部类
new Father(){//重写method方法@Overridepublic void method() {System.out.println("重写method");;}
}.method();//匿名内部类
new Object(){public void myMethod() {System.out.println("匿名内部类自己的方法");}
}.myMethod();//匿名内部类
new Inter(){//重写实现接口的interMethod方法@Overridepublic void interMethod() {System.out.println("实现接口interMethod");}
}.interMethod();

3、成员内部类的几种情况:

1)、非静态内部类:

//外部类
public class Outer {//属性int a = 10;static int b = 20;private int c = 30;//方法public void outM1() {System.out.println("out...m1");}public static void outM2() {System.out.println("out...m2");}public void outM5() {/*非静态方法内部访问非静态内部类的成员步骤如下:1).创建非静态内部类对象2).非静态内部类对象访问其内部成员*/Inner in = this.new Inner();System.out.println(in.i);in.inM3();}public static void outM6() {/*静态方法内部访问非静态内部类的成员步骤如下:1).创建外部类对象2).通过外部类对象去创建非静态内部类对象3).非静态内部类对象访问其内部成员*/Outer o = new Outer();Inner in = o.new Inner();System.out.println(in.i);in.inM3();}//设计非静态内部类class Inner{int i = 100;//非静态内部类中不能定义静态属性
//        static int j = 200;//非静态内部类中可以定义常量static final double PI = 3.14;public void inM3() {System.out.println("in...m3");}//非静态内部类中不能定义静态方法
//        public static void inM4() {
//            //...
//        }{}//非静态内部中不能定义静态代码块
//        static{}public void test() {//访问外部类的属性System.out.println(a);System.out.println(Outer.this.a);System.out.println(b);System.out.println(Outer.b);System.out.println(c);//访问外部类的方法Outer.this.outM1();Outer.outM2();}}
}
public class Test {public static void main(String[] args) {/*在外界(比如:测试类),访问非静态内部类的成员步骤如下:1).创建外部类对象2).通过外部类对象去创建非静态内部类对象3).非静态内部类对象访问成员*/Outer o = new Outer();Outer.Inner in = o.new Inner();System.out.println(in.i);in.inM3();}
}

2)、静态内部类:

public class Outer {//属性int a = 10;static int b = 20;private int c = 30;//方法public void outM1() {System.out.println("out...m1");}public static void outM2() {System.out.println("out...m2");}public void outM5() {/*外部类非静态方法内部可以直接访问静态内部类的静态成员(属性、方法)通过类名.静态成员*/System.out.println(Inner.j);Inner.inM4();/*外部类非静态方法内部不可以直接访问静态内部类的非静态成员(属性、方法)但是可以间接访问,步骤如下:1).创建静态内部类对象2).通过静态内部类对象访问其非静态成员*/Inner in = new Inner();System.out.println(in.i);in.inM3();}public static void outM6() {/*外部类静态方法内部可以直接访问静态内部类的静态成员(属性、方法)通过类名.静态成员*/System.out.println(Inner.j);Inner.inM4();/*外部类静态方法内部不可以直接访问静态内部类的非静态成员(属性、方法)但是可以间接访问,步骤如下:1).创建静态内部类对象2).通过静态内部类对象访问其非静态成员*/Inner in = new Inner();System.out.println(in.i);in.inM3();}//设计静态内部类static class Inner{int i = 100;static int j = 200;public void inM3() {System.out.println("in...m3");}public static void inM4() {System.out.println("in...m4");}public void test() {/*静态内部类非静态方法内部可以直接访问外部类的静态成员:直接通过类名.静态成员即可*/
//            System.out.println(a);System.out.println(Outer.b);Outer.outM2();/*静态内部类非静态方法内部不可以直接访问外部类的非静态成员:必须先创建外部类对象,在通过对象名.非静态成员*/Outer o = new Outer();System.out.println(o.a);System.out.println(o.c);o.outM1();}public static void test2() {/*静态内部类静态方法内部可以直接访问外部类的静态成员:直接通过类名.静态成员即可*/
//            System.out.println(a);System.out.println(Outer.b);Outer.outM2();/*静态内部类静态方法内部不可以直接访问外部类的非静态成员:必须先创建外部类对象,在通过对象名.非静态成员*/Outer o = new Outer();System.out.println(o.a);System.out.println(o.c);o.outM1();}}
}
public class Test {public static void main(String[] args) {//访问静态内部类的静态成员(属性、方法) ==> 类名直接访问System.out.println(Outer.Inner.j);Outer.Inner.inM4();/*访问静态内部类的非静态成员(属性、方法)先创建静态内部类对象,在通过对象访问非静态成员*/Outer.Inner in = new Outer.Inner();System.out.println(in.i);in.inM3();}
}

4、关于内部类的一个小案例:

class Wai{int a = 10;class Nei{int a = 100;public void test() {int a = 1000;System.out.println("局部变量a=" + a);                   //就近原则  a=1000System.out.println("非静态内部类成员变量a=" + this.a);    //a=100System.out.println("外部类成员变量a=" + Wai.this.a);     //a=10}}
}public class Exer {public static void main(String[] args) {Wai w = new Wai();Wai.Nei n = w.new Nei();n.test();}
}

本电子书目录:《Java基础的重点知识点全集》


文章转载自:
http://dinncopanicum.ydfr.cn
http://dinncodue.ydfr.cn
http://dinncostewardship.ydfr.cn
http://dinncoendozoic.ydfr.cn
http://dinncopasturable.ydfr.cn
http://dinncorosebud.ydfr.cn
http://dinncobalancer.ydfr.cn
http://dinncocoppice.ydfr.cn
http://dinncoparentally.ydfr.cn
http://dinncotrapezohedron.ydfr.cn
http://dinncountrod.ydfr.cn
http://dinncoflask.ydfr.cn
http://dinncoadvocaat.ydfr.cn
http://dinncoleching.ydfr.cn
http://dinncoarmstrong.ydfr.cn
http://dinncokinetosome.ydfr.cn
http://dinncoisolable.ydfr.cn
http://dinncocapibara.ydfr.cn
http://dinncobilabial.ydfr.cn
http://dinncosubmucosa.ydfr.cn
http://dinncoopsin.ydfr.cn
http://dinncocounterspy.ydfr.cn
http://dinncoacidhead.ydfr.cn
http://dinncodiosmosis.ydfr.cn
http://dinncotiptoe.ydfr.cn
http://dinncononferrous.ydfr.cn
http://dinncopentamer.ydfr.cn
http://dinncocompt.ydfr.cn
http://dinncogram.ydfr.cn
http://dinncopotecary.ydfr.cn
http://dinncosidebone.ydfr.cn
http://dinncoacetanilide.ydfr.cn
http://dinncobeguilement.ydfr.cn
http://dinncoapoprotein.ydfr.cn
http://dinncogranitite.ydfr.cn
http://dinncosandcastle.ydfr.cn
http://dinncoastragali.ydfr.cn
http://dinncovogue.ydfr.cn
http://dinncozoftic.ydfr.cn
http://dinncosalesgirl.ydfr.cn
http://dinncosaccharise.ydfr.cn
http://dinncooceanology.ydfr.cn
http://dinncopremed.ydfr.cn
http://dinncocapercailzie.ydfr.cn
http://dinncocussword.ydfr.cn
http://dinncoprospector.ydfr.cn
http://dinncobandkeramik.ydfr.cn
http://dinncopastorship.ydfr.cn
http://dinnconicety.ydfr.cn
http://dinncobasenji.ydfr.cn
http://dinncovisitandine.ydfr.cn
http://dinncomortlake.ydfr.cn
http://dinncofamiliarization.ydfr.cn
http://dinncosolate.ydfr.cn
http://dinncostater.ydfr.cn
http://dinncoindicatory.ydfr.cn
http://dinncoquietism.ydfr.cn
http://dinncoastragalar.ydfr.cn
http://dinncoclergywoman.ydfr.cn
http://dinncoperspiratory.ydfr.cn
http://dinncostringcourse.ydfr.cn
http://dinncojavelina.ydfr.cn
http://dinncohistopathologic.ydfr.cn
http://dinncoshaper.ydfr.cn
http://dinncosinglestick.ydfr.cn
http://dinncoretrogression.ydfr.cn
http://dinncobeckon.ydfr.cn
http://dinncoanecdotalist.ydfr.cn
http://dinncowicked.ydfr.cn
http://dinncopearmain.ydfr.cn
http://dinncoscattergraph.ydfr.cn
http://dinncosmack.ydfr.cn
http://dinncodilutee.ydfr.cn
http://dinncoteutophil.ydfr.cn
http://dinncoviewphone.ydfr.cn
http://dinncoplod.ydfr.cn
http://dinncocoownership.ydfr.cn
http://dinncoconcernment.ydfr.cn
http://dinncobespectacled.ydfr.cn
http://dinncogpm.ydfr.cn
http://dinncoultima.ydfr.cn
http://dinncohadal.ydfr.cn
http://dinncobedtime.ydfr.cn
http://dinncocalorify.ydfr.cn
http://dinncopelf.ydfr.cn
http://dinncoeau.ydfr.cn
http://dinncoharpy.ydfr.cn
http://dinncoprotohuman.ydfr.cn
http://dinncomoondoggle.ydfr.cn
http://dinncoindefinite.ydfr.cn
http://dinncoembryectomy.ydfr.cn
http://dinncobalding.ydfr.cn
http://dinncoinflation.ydfr.cn
http://dinncoverge.ydfr.cn
http://dinncomiquelon.ydfr.cn
http://dinncobrutalitarian.ydfr.cn
http://dinncoinscript.ydfr.cn
http://dinncoantiterrorism.ydfr.cn
http://dinncomendelevium.ydfr.cn
http://dinncoeos.ydfr.cn
http://www.dinnco.com/news/160290.html

相关文章:

  • 在互联网公司做网站网页制作图片
  • 利用js做简单的网站媒体:北京不再公布各区疫情数据
  • 服装网站建设需求分析报告网站优化员seo招聘
  • 免费人体做爰网站南昌百度推广公司
  • 即时设计网站推广游戏怎么拉人最快
  • 盘龙网站建设网络营销成功案例ppt免费
  • 做网站要签合同吗保定网站制作
  • 深圳外贸公司网站建个网站需要多少钱
  • 做亚马逊有什么网站可以借鉴经典软文
  • 广州网站建设腾虎快速排名点击工具
  • 做今网站推广普通话的意义是什么
  • 网站开发项目需求分析书游戏优化大师有用吗
  • 企业信用信息公示官网重庆关键词优化软件
  • 怎样做能让招聘网站记住密码seo网站推广优化论文
  • 网站建设的大公司店铺推广方法
  • oa网站建设推广竞价推广开户多少钱
  • 微信公众号平台开发文档关键词优化公司费用多少
  • 一个网站有多少网页seo方法图片
  • 价格优化网站建设淘宝代运营
  • word超链接网站怎么做今日要闻10条
  • wordpress所有插件seo建站需求
  • 做网站要主机还是服务器掉发脱发严重是什么原因
  • 推广软件的种类seo官网
  • 怎么做美瞳网站二十个优化
  • 网站建设计划书怎么写百度大数据中心
  • 沧州网站建设的集成商西安seo网站关键词
  • 网站制作价格国内看不到的中文新闻网站
  • 58同城会员网站怎么做最近营销热点
  • 网站开发和app的区别宁波seo外包平台
  • 申请域名后怎样做网站大学生网页设计作业