Skip to main content

All Questions

9 votes
4 answers
3k views

OOP Design considering no modifications to existing design

The question is: interface Animal { void eat(); } class Lion implements Animal{ public void eat(){ //do somethng } } class Test { public static void main(String[] args) { ...
beginner_coder's user avatar
4 votes
2 answers
111 views

How are settings structured when they can be configured in diffferent ways?

Suppose of this question the following: I'm in full control of this project I'm writing a media player Obviously, a media player will allow a user to adjust the volume, so I might have a class that ...
user avatar
0 votes
3 answers
368 views

Send records using async or sync way

I have bunch of keys and values that I want to send to our messaging queue by packing them in one byte array. I will make one byte array of all the keys and values which should always be less than 50K ...
user1950349's user avatar
-1 votes
3 answers
2k views

Can I say Interface is a set of general behavior? [duplicate]

I'm new to OOP. Can I say Interface is a set of general behavior that may be have and act uniquely by a set of objects that have in common? And Abstract class has similarity with Interface but it have ...
Hendy's user avatar
  • 11
1 vote
1 answer
349 views

How to design the system which executes two process independently with different configuration?

I have two process ProcessA and ProcessB. I want to run these two process independent of each other. There is no relation between them at all. Each process should have a different Properties object. ...
david's user avatar
  • 123
1 vote
3 answers
4k views

Why List<E> interface is additionally introduced in collection hierarchy? [duplicate]

Below is the diagram, where, if we just consider the implementations of List, AbstractList maintains the core behavior of list. To introduce the new implementation class MyList(say) one can inherit ...
overexchange's user avatar
  • 2,305
2 votes
5 answers
6k views

Should abstract classes be used to prevent instantiation

Is preventing the instantiation of a class a valid reason to make it abstract? For example, if I have a class called Gauge which has subclasses HeadingIndicator and AirSpeedIndicator, is it a good ...
TheRealJimShady's user avatar
1 vote
3 answers
44k views

I want to understand clearly why can't we instantiate an object of an abstract class [duplicate]

Can I get a clear explanation why why can't we instantiate an object of an abstract class. I know abstract is not real. But I want to know more why can't we instantiate an object of an abstract class.
King's user avatar
  • 121
5 votes
6 answers
9k views

What are abstract classes and abstract methods?

I got several explanations but so far I'm not able to understand that what are the abstract classes and methods in Java. Some said it has to do something with the security of the program, other said ...
Umer Hassan's user avatar
43 votes
9 answers
117k views

Why should I declare a class as an abstract class?

I know the syntax, rules applied to abstract class and I want know usage of an abstract class Abstract class can not be instantiated directly but can be extended by other class What is the ...
Vaibhav Jani's user avatar