Files
Java/实验报告模板/实验报告4/实验讲课.txt
2025-11-06 10:29:13 +08:00

19 lines
1022 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
接口
若类中的所有的方法都是抽象方法,并且没有成员变量----->接口
抽象类:可以有成员变量、可以有普通方法、可以有抽象方法
接口:
(1)没有成员变量,只有常量与抽象方法,接口中定义的所有方法都是抽象方法
(2)即接口不可以直接创建象,接口必须通过派生子类来创建对象
(3)接口中所有方法都必须在子类中重写。
(4)接口中可以定义常量
int footnum=2;<===>public final static int footnum=2;
(5)接口可以多继承1个类可以继承多个接口但1个类只能继承1个父类
final,staic
public final static int footernum=-1; //定义了静态、常量,可以通过类名调用
public static int footernum=-1; //静态常量,该变量可以被类创建的所有对象共享,可以通过类名调用
public final int footernum=-1; //常量,该常量,必须通过对象名来调用
设计1个用户用户有用户名密码属性登录注册动作、方法