Lumarc
Lumarc
JCHJava Community | Help. Code. Learn.
Created by Lumarc on 1/11/2025 in #java-help
Simple Java Trace Code
Alright noteddd, thanks to bothh of ya 🤩
17 replies
JCHJava Community | Help. Code. Learn.
Created by Lumarc on 1/11/2025 in #java-help
Simple Java Trace Code
got it, so the A myA = new B(); is the reason why it's 5, causing polymorphism for only instance methods, right?
17 replies
JCHJava Community | Help. Code. Learn.
Created by Lumarc on 1/11/2025 in #java-help
Simple Java Trace Code
wahh thanks a lot for the lengthy explanation! 🤩 My confusion is it being 5 rather than 7, as since it's hooked to B class, I thought it will override and output 7 instead? Definitely my understanding of how declaration of variables / data fields work is wrong here :idontunderstand: or as @dan1st | Daniel said, the a field in class B is just a copy and has no relation with a in class A? If yes, how do I call 7?
17 replies