Skip to main content

All Questions

Tagged with
0 votes
5 answers
2k views

Comparing Java objects with different member variables

I have a base class "People" which two other classes inherit from: Employee and Student. The Student class includes a GPA (type double) and the Employee class does not. I have an ArrayList ...
Delta88's user avatar
  • 19
1 vote
4 answers
1k views

Why have separate keywords for 'extends' and 'implements' in Java? [closed]

Short answer that I've come to accept: Firstly, it helps with readability, being able to see which is the superclass apart from interfaces. Secondly, though 'extends' and 'implements' do the same ...
xtratic's user avatar
  • 456
14 votes
5 answers
8k views

Inheritance vs additional property with null value

For classes with optional fields, is it better to use inheritance or a nullable property? Consider this example: class Book { private String name; } class BookWithColor extends Book { private ...
Bojan VukasovicTest's user avatar
0 votes
3 answers
48k views

Using super keyword to access super class members

I have following questions about the super keyword in java: I have a code below with classes: A Extends no class contains integer variable i B Extends class A contains integer variable i C Extends ...
With A SpiRIT's user avatar
66 votes
11 answers
65k views

In Object-Oriented Programming, why is it generally desirable to split a program into multiple classes? [closed]

After studying Programming through books, they have taught me concepts such as inheritance, but never explain how splitting a program into multiple classes helps with anything. Yet, many books seem to ...
kullalok's user avatar
  • 1,085