Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi I was having a problem with java implementation. Basically, I got a jar file

ID: 3628418 • Letter: H

Question

Hi I was having a problem with java implementation.

Basically, I got a jar file that held the I/O and interfaces that I must implement. I added it to the library of my eclipse and I managed to implement the classes in there as an interface.

My question is this: Let's say one of the method written in interface named "qwerty" has return type of "qwerty."

To be precise, the method returns a List of "qwerty" object. But I cannot define object "qwerty" anywhere else because class with that name is taken in library and jar file does not include the source code.

How am I supposed to handle the "qwerty" object?

Explanation / Answer

You mentioned that "qwerty" is an interface in your program. So, there is no sense in discussing "object qwerty" as objects are instances of classes not interfaces. By return type qwerty he means that it returns an object which implements the interface "qwerty". For example if there is a class "asdf" which implements interface "qwerty". Then List can be a valid return. U can handle asdf using a reference to "qwerty" as shown below. asdf obj=new asdf(); qwerty item=(qwerty)obj; I hope i answered your question. If you still have doubts, please let me know.
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote