Home>

Hello everyone!

Guys, the question is funny, but I'm new to Java, just originated.

I gave me a small test task at the interview, where you need to implement a service based on interface issued .

During the task, I made my own exceptions to myException and somewhere they are called, respectively, Throws added in these methods.

i.e. it was like this:

Public Interface TaskinTerface {
/**
* Some Method1
* /
Public Method1 (String Param1, String Param2);
....
....
}

and it became like this:

Public Interface TaskinTerface {
/**
* Some Method1
* /
Public Method1 (String Param1, String Param2) Throws MyeException;
....
....
}

as far as it can be critical for verifies?

i.e. Roughly speaking gave one, and I wrote for a little different ... i.e. On the face, violation of the execution of announced TK. Or not all scary?

Thank you!

It seems to me, it was worth not to rewrite the specified interface, but write my own inheriting from the specified one, and there to override these methods, not?

Heidel2021-05-03 01:01:17

Somehow it looks strange ... i.e. Just create a new newinterface extends taskinterface and went drove? Is it necessary to do this in this situation?

drcosmo2021-05-03 01:01:17

As it seems to me, first of all, the question is whether it was possible to implement what was required by the task using only the issued interface? Are you sure that all your changes that you have entered the interface are exactly necessary and that without them could not do without them? If so, then in this case, it seems to create your interface based on the specified seem to me more kosher. Well, purely according to my impressions.

Heidel2021-05-03 01:01:17

In order to answer the question of what to do with a mistake you need to know which method of performing the method. If you look at the designation you specified, the returned result is not at all (i.e. it is not specified). Further there are several options: 1) We throw Exception to the top 2) We write in Log 3) Provide a refund of the error as part of the answer (if the method returns some kind of object) P.S. I hope still in your TK is the result of the function of the function, if you are unnoticed and did not specify this to you minus

jmu2021-05-03 01:01:17

Yes, I forgot to indicate in the question) Of course there is a type of return value

drcosmo2021-05-03 01:01:17