+ 4
have you ever used interface in your project???
if u have ever used interface or abstract class in ur project..then can u tell me what type of benefits did u get???
8 Réponses
+ 11
Referring to oop principles:
Interfaces: for encapsulation, generic interface: for polymorphism
Abstract class: for abstraction
You can search for the oop tags on Google to understand their benefits.
+ 6
I think you, visit my latest Java codes for your problems.i hope they will help you?☺
+ 5
Yes of course. Interfaces are very important even in your own project (don't want to share with anybody) if something has multiple implementation. For example:
- if you create a calculator then operator should be an interface
- if you create a drawing app then a shape should be an interface
- if you create video or audio player then codec is an interface too
If you don't use interfaces then probably you have ugly if else if else ... sequences in your code.
+ 3
It is hard to explain it here. Try to create a simple program which accepts commands from standard input, for example (help, exit, sayhello, echo, ...). I wonder how you would do it. What would you do if you want to add a few new acceptable commands. Please write here your solution. I don't want a fully working code, just concept.
+ 3
Hi,
I created a few codes for you, check my codes:
Commands without interfaces: this is the shortest solution without interfaces, uses ugly if else commands.
Commands with interfaces: it is longer but it is a better solution for a larger project where you have to add more implementations
Commands with enums: in this case it is the best solution. No if else needed and it is easier to find out what kind of commands are available
+ 1
uufffffffffffffffff....i know what is interface...but practically i have never used i don't understand where to use and why??
0
tamas....but we don't share our source code.. sorry..but still i could not understand
0
tamas..leave it..i think u r too good...i could not understand what u wanted me to do...u know 12 languages..how?u r great