Files

37 lines
1.2 KiB
Plaintext

=== Q10 The four pillars of OOP ===
Circle area = 3.14
Rectangle area = 6.00
rejected: amount must be positive, balance still 500.0
=== Q11 Inheritance and constructor chaining ===
Animal constructor
Dog constructor
Animal constructor
Puppy constructor for Bruno
=== Q12 Method overloading vs overriding ===
FancyPrinter.show(Object)
show(String)
FancyPrinter.show(Object)
=== Q13 Abstract class vs interface ===
Scooter has 2 wheels, charging, plug Type 2
=== Q14 Polymorphism: what is and is not dynamic ===
Child.who() | Parent.field | Parent.static | Child.static
=== Q15 Can you override static, private or final methods? ===
Base.secret | Base.locked
=== Q16 How do you create an immutable class? ===
members: [Asha, Ravi]
add blocked: UnsupportedOperationException
=== Q17 Composition vs inheritance (is-a vs has-a) ===
stack = [99, 1, 2], pop gives 2
=== Q18 Access modifiers ===
a -> public
b -> protected
c -> (package-private)
d -> private
=== Q19 Object class methods: toString, equals, hashCode ===
default toString looks like ClassName@hex: true
p1.equals(p2) = true
set contains an equal point: false
=== Q20 Constructors: default, chained and private ===
default config: dev:8080
same Registry instance: true