It may be confusing at the start. I think it should be explicit as term's literal meaning.
Interface is a communication protocol defines how a class of instances interacts with the external world, i.e. other instances. So interface method is about abstract instance methods.
Abstract class is a place to put common attributes and methods of a class in one place. It could be class or instance members.
Interface and abstract class are abstract, so they won't have any implementation. One class can implement several interfaces, depending on how many deceives or channels via which it interacts with the external objects. Abstract class could have implemented method and fields. They are common members of the class or its instances.
Interface can only define constants, and fields defined in the interface are implicitly considered as 'public static final'. Interface abstracted methods can only be defines as public, for they are used as communication to the external.
Abstract class as explained before, as explained it is a common place to put all the common features in one place; so you may define member access, as public, protected, default, and even private.
We can define constant and abstracted method in the interface; in the java 8, we may declare static method also in the interface.
Sunday, 13 March 2016
What is Servlet
Servlet sounds like "let/making server do something". Actually, it bind the java class and HTTP request together. Meaning that, it is a common interface and handler, which is able to handle remote request and dispatching to the underlying java class handler, and generate response to the remote caller.
Servlet life cycle, init(), service(), and destroy(). they are implemented by the container.
init() the input parameters extracted from httprequest; service() is the functional handler; when the requested task has been done, then container will call destroy() to terminate servlet.
Subscribe to:
Posts (Atom)
Can Jackson Deserialize Java Time ZonedDateTime
Yes, but must include JSR310. Thus ZonedDateTime can be deserialized directly from JSON response to POJO field. <dependency> <g...
-
Could not extract response: no suitable HttpMessageConverter found for response type [class dk.enettet.evu.core.model.Address] and content ...
-
First time met this hibernate exception. I think this issue should due to one to one relationship. One driver has one car; one car has on...
-
A large object refers to the entity property that is modified by @Lob. It may be persisted in several records. However, in database manage...