【入门基础】对Java的学习(二)

编程开发   © 文章版权由 admin 解释,禁止匿名转载

#楼主# 2023-3-19

本贴是Java学习,讲解Java基础知识,赶快进来看看吧!

麻烦路过的大哥大姐,觉得不错,点个赞,给个回复一下呗![爱心]


[玫瑰]本期内容如下:

1. JAVA类包
2.内部类
3.this
4..匿名内部类
5.核心技术


( * 点赞 * 关注 * 留言 )

——教程楼更——
建议开启只看楼主模式
◎觉得我的教程不错就快关注我吧◎


内容来自于互联网!

11楼
LV是非 2023-3-19
如下定义:
12楼
LV是非 2023-3-19
public class Car{
class Engine{

}
public static void main(String[] args){
Car.Engine engine = car.new Engine();
}
}
13楼
LV是非 2023-3-19
成员内部类不止可以在外部类中使用,在其他类中也可以使用。
14楼
LV是非 2023-3-19
3.this
15楼
LV是非 2023-3-19
public class Car{
private int x = 7;
private class Engine{
private int x = 9;
public void doit(){
this.x ++; //调用内部类
Car.this.x++; //调用外部类
}
}
}
16楼
LV是非 2023-3-19
匿名内部类
17楼
LV是非 2023-3-19
只有在创建对象时才会编写类体的一种写法-------现用现写。
18楼
LV是非 2023-3-19
class Dog{}

public class Demo{
public static void main(String[] args){
Dog wang = new Dog(){
public void move(){}

}; //注意有分号
wang.move();
}
}
19楼
LV是非 2023-3-19
匿名类不能写构造方法。
20楼
LV是非 2023-3-19
匿名类不能定义静态成员。

评论

登录后才可发表内容
  • 主题

    84

  • 帖子

    15458

  • 关注者

    0

Copyright © 2019 凯特网.   Powered by HYBBS 2.3.4  

Runtime:0.3636s Mem:2124Kb