Current location - Loan Platform Complete Network - Foreign exchange account opening - Write an interface with java to realize data docking
Write an interface with java to realize data docking
line

clazz="xxx "

zone

area=class.forname(clazz)。 new instance();

Xxx is the class that implements your interface.

This is the legendary reference of the parent class to the subclass object, polymorphism.

The second sentence is equivalent to

zone

Area = new

XXX();

The reference of the parent class can only call the method implemented by the subclass, and cannot call the method that exists in the subclass but not in the parent class.

When the reference of the parent class points to the object of the subclass, its calling method is realized by the method of the subclass.