/**
* 彥舜原創,CSDN首發
*/
package cn.yanshun.design;
/**
* @author 彥舜
*
*/
public class Test3_Design {
/**
*
*/
public Test3_Design() {
// TODO Auto-generated constructor stub
}
/**
* @param 這個類用於在程序開發設計中,面向對象中,面向接口編程思想,的應用
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
//使用、測試接口或抽象類,通過實例化對象的創建,進行測試、使用:創建多態對象
//報小黃線:The value of the local variable t1 is not used
Teacher1 t1 = new Student();
t1.eat();
t1.sleep();
t1.love();
//static數據,類名或接口名直接調用,位於內存中的公共數據區/公共代碼區
//t1.statics(); //報錯:This static method of interface Teacher1 can only be accessed as Teacher1.statics
Teacher1.statics();
//static數據,類名或接口名直接調用,位於內存中的公共數據區/公共代碼區
// System.out.println(t1.ACCOUNT); //報小黃線:The static field Teacher1.ACCOUNT should be accessed in a static way
System.out.println(Teacher1.ACCOUNT); //報小黃線:The static field Teacher1.ACCOUNT should be accessed in a static way
System.out.println(Teacher1.CODE);
/** 子類即實現類,
彥舜原創,CSDN首發:面向接口編程思想,設計程序
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.