摘要:
抽象类和接口都是java中用来实现多态的方法,在此主要说明为什么会用抽象类来实现接口,因此对两者之间的异同就不介绍了。 在java一般的用法中,如果要用普通类来实现接口,则必须实现该接口中的所有方法,这样就会导致需要实现多余的方法; 采用抽象类来实现方法,可以实现该接口中的部分方法,而且当其他类继承 阅读全文
摘要:
public class sample{ public static void main(String[] args){ //得到类的简写名称 System.out.println(sample.class.getSimpleName()); //得到对象的全路径 System.out.printl 阅读全文