Stephan van Hulst wrote:First, polymorphism only applies to non-private instance methods. It doesn't apply to fields. So when the Ship class refers to weight or height, it will always be the weight or height field that is a member of the Ship class, not the field that is declared in the RocketShip class. Fields also don't override each other: RocketShip.weight is a completely different and unrelated field to Ship.weight.
Amazon wrote:OCP Oracle Certified Professional Java SE 17 Developer (Exam 1Z0-829) Programmer's Guide is a unique guide that combines a rigorous introduction to programming in Java with meticulous coverage of the Java SE 17 and Java SE 11 Developer exam objectives. Fully updated to reflect changes in the latest exams, it features an increased focus on analyzing code scenarios--not just individual language constructs. Each objective is thoroughly addressed, reflecting the latest features and APIs, as well as best practices for taking the exam. The only book anyone needs to study for Java SE 17 Developer or Java SE 11 Developer certification. Book features include:
Easy to find coverage of key topics relevant to each exam objective
An introduction to essential concepts in object-oriented programming (OOP) and functional-style programming
In-depth coverage of declarations, access control, operators, flow control, OOP techniques, lambda expressions, streams, modules, concurrency, Java I/O, key API classes and much more
Program output demonstrating expected results from complete Java programs
Unique diagrams to illustrate important concepts, such as Java I/O, modules, and streams
Extensive use of Unified Modeling Language (UML) to illustrate program design
Dozens of review questions with annotated answers to help prepare for the exam and a complete mock exam
int i1 = c1 + c2; //Here c1 and c2 are promoted to ints?
char c3 = c1 + c2; //How about here?
int i2 = 'a' + 'b'; //There is no promotion?
char c4 = c1 + c2; //How about here?