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