4761人加入学习
(15人评价)
Java编程学习第二季

制作于2018年3月14日

价格 免费

成员变量:new出来 定义在类

局部变量:调用方法的时候 

[展开全文]

内部类可以访问外部类的成员,外部类可以

[展开全文]

final 修饰变量、类、方法:

1 变量无法被修改

2 类无法被继承

3 方法无法别重写

 

[展开全文]

优点:1减少代码量2代码变得简洁3代码更加容易维护变得

单继承,不是多继承(很好)

就近原则(同名时):

控制  this.name,super.name

[展开全文]

调用父类的构造方法:

super() 无参构造方法

super(name, age,gender,birthday)

[展开全文]

this 指针 只能在类里使用 代表当前对象

[展开全文]

private 只能在类的内部使用

局部变量 成员变量 

栈 堆

存储

回收机

class   ..{

   public static void main(String[] args){

 

}

}

class Student{

   String name;

}

没有定义构造方法时默认构造方法:起到一个初始化的

public name(){

 

 

}

[展开全文]

System.out.println("open");

System.out.println("take");

System.out.println("close");

class BingXiang{

int capacity;

Stirng brand;

String model;

String content;

public void open(){

System.out.println("open the icebox")

}

public void close(){

System.out.println("close the icebox")

}

public void put(String name){

content = name;

}

}

BinXiang bc = new BingXiang();

bc.open();

bc.put("daxiang");

bc.close();

 

[展开全文]

class Demo{

  public static void main(String[] args){

   Plane p1 = new Plane();

  Syetem.out,println(p1.model);

  System.out.println(p1.length);

  System.out.println(p1.zaiKeLiang);

 

Plane p2 = new Plane();

  Syetem.out,println(p1.model);

  System.out.println(p1.length);

  System.out.println(p1.zaiKeLiang);

}

}

class Plane{

Stirng model;

float length;

int zaiKeliang;

}

 

[展开全文]
  • 类public 的defalut 类使用的作用域 有两个 包内,包外
[展开全文]
  • 默认权限修饰符只能在本包里访问
[展开全文]
  • final 定义的常量只能被赋值一次
[展开全文]

授课教师

SiKi学院老师

课程特色

下载资料(1)
视频(87)