Improve comments

This commit is contained in:
Marcus Vinicius de Carvalho 2024-10-23 19:00:05 +08:00
parent bd3c2688f4
commit 38961badd7
1 changed files with 5 additions and 7 deletions

View File

@ -14,17 +14,15 @@ public class Main {
// a.print(88); // Compilation error // a.print(88); // Compilation error
// IV - // IV -
// ClassA a = new ClassC(); // Ok -> Upcast A<-C // ClassA a = new ClassC(); // Ok
// ClassG g = (ClassG)a; // Compile Error on some JDKs -> Downcast G<-(A<-C) // ClassG g = (ClassG)a; // Runtime error
// g.print("hello"); // RunTime error // g.print("hello");
// Upcast is prone to Compiler error and Runtime error
// Downcast is prone to Runtime error
// V - We lost track of the print(string, string) in C become it become a A first // V - We lost track of the print(string, string) in C become it become a A first
// ClassA a = new ClassC(); // ok // ClassA a = new ClassC(); // ok
// ClassG g = (ClassG)a; // Compile Error on some JDKs // ClassG g = (ClassG)a; // Runtime error
// g.print("hello", "there"); // Runtime error // g.print("hello", "there");
// VI // VI
// ClassA a = new ClassF(); // OK // ClassA a = new ClassF(); // OK