Os:windows7 x64
Jdk:jdk-8u131-windows-x64
Ide:eclipse Oxygen Release (4.7.0)
Code:
Abstract class Person {public abstract void SayHello ();} Class Javaer extends Person{public void SayHello () {System.out.println ("Java Hello");}} Class Demo {//abstract class reference as parameter of function//no problem public static void test (person p) {P.sayhello ();//p points to an object that must be a subclass}public static void Main ( String[] agrs) {person p = new Javaer (); test (P);}}
Results:
Java is good, worth learning.
Learning resources: Itcast Video Library. If you have public resources, can share to me, with your resources to learn also can.
Blog post is to watch the video, into thinking written. It's good that the teacher speaks well. Blog bad, is to give the most bitter not serious.
If you think the blog can be improved, leave a message.
JavaSE8 a reference to the underlying abstract class as a function's argument to an object that must be a subclass