Java Study Note: Reference and Object

zhaozj2021-02-16  107

I Never Refuse to Confss That I am A Newbie of Java Programming.

IT TOOK ME Some Time To Understand The Connection Between Reference And Object, The Difference Between Reference and Pointer (i Learned The Concept In C / C ) and the magnificant usage of upcasting.

Upcasting is really a very useful concept that every Javer must keep it in mind It can not only help hide implementation of the derived class, but make it possible to use anonymous class that implements an interface, as I will show you below.:

Interface i {void play ();

Public Class C {Private I Go () {{{{{{{{{{system.out.println ("" ");}} Static void main (string [] args) {c = new c (); i = C.GO (); I.PLAY ();}}

You will see the upcasting as well as anonymous class here :-)

转载请注明原文地址:https://www.9cbs.com/read-13473.html

New Post(0)