final int final_test;
{
final_test =10; //we can initialize the final variable here as well.
}
classname(){
final_test = 20; //also here.
}
{
final_test =10; //we can initialize the final variable here as well.
}
classname(){
final_test = 20; //also here.
}
2017-05-18
package com.imooc.Test;
public abstract class Shape {
public abstract void Perimeter();
public abstract void area();
}
public abstract class Shape {
public abstract void Perimeter();
public abstract void area();
}
2017-05-18
1.static int;
2.static block;
3.test t = new test();
4.instance variable;
5.block;
6.construture function test();
7.test tt = new test(88);
8.instance variable again;
9.block again
10.construture function test(int aa);
...从上面的执行顺序能够理解class variable,instance variable,class block,instance block order
2.static block;
3.test t = new test();
4.instance variable;
5.block;
6.construture function test();
7.test tt = new test(88);
8.instance variable again;
9.block again
10.construture function test(int aa);
...从上面的执行顺序能够理解class variable,instance variable,class block,instance block order
2017-05-18
package com.imooc.duotai;
public class Initail {
public static void main(String[] args) {
Traffic o=new Traffic();
Traffic p=new Airport();
Traffic q=new Bus();
Traffic r =new Ship();
o.transport(0);
p.transport(200);
q.transport(40);
r.transport(400);
}
}
public class Initail {
public static void main(String[] args) {
Traffic o=new Traffic();
Traffic p=new Airport();
Traffic q=new Bus();
Traffic r =new Ship();
o.transport(0);
p.transport(200);
q.transport(40);
r.transport(400);
}
}
2017-05-16
package com.imooc.duotai;
public class Bus extends Traffic {
public void transport(int num){
System.out.println("大巴车的运输方式是在路上跑,能载"+num+"人");
}
}
public class Bus extends Traffic {
public void transport(int num){
System.out.println("大巴车的运输方式是在路上跑,能载"+num+"人");
}
}
2017-05-16
package com.imooc.duotai;
public class Airport extends Traffic {
public void transport(int num){
System.out.println("飞机载客的方式是运行在天上飞,能载"+num+"人");
}
}
public class Airport extends Traffic {
public void transport(int num){
System.out.println("飞机载客的方式是运行在天上飞,能载"+num+"人");
}
}
2017-05-16