Why marker interfaces are used in java
November 29, at PM Unknown said Superb Article. Good artical ,and the comments are also awesome. October 18, at PM Unknown said November 12, at AM Santosh said February 21, at PM Unknown said August 6, at AM javin paul said August 9, at AM akshobhya said It is marker interface, not "market interface".
October 23, at AM Anonymous said December 5, at AM Nikhil Gupta said January 13, at AM javin paul said January 14, at AM. Newer Post Older Post Home. Subscribe to: Post Comments Atom. Subscribe for Discounts and Updates Follow. Search This Blog. Interview Questions core java interview question data structure and algorithm 76 Coding Interview Question 74 interview questions 70 design patterns 35 SQL Interview Questions 34 object oriented programming 34 thread interview questions 30 spring interview questions 28 collections interview questions 25 database interview questions 16 servlet interview questions 15 Programming interview question 6 hibernate interview questions 6.
How to design a vending machine in Java? How HashMap works in Java? Why String is Immutable in Java? Translate This Blog. ClassNotFoundException: org. Law of Demeter in Java - Principle of least Knowle When to Make a Method Static in Java? Is it possible to have an abstract method in a fin Top 5 Courses to learn Groovy and Grails in Why Enum Singleton are better in Java? Difference between repaint and revalidate method i How to Count number of Set bits or 1's of Integer When a class is loaded and initialized in JVM - Ja Is Swing Thread Safe in Java?
How to get current URL, parameters and Hash tag us How ClassLoader Works in Java? Example 3 ways to solve java. NoClassDefFoundError in How to use Comparator and Comparable in Java? How to compare two lists of values in Microsoft Ex How to increase Heap memory of Apache Tomcat Serve What is bounded and unbounded wildcards in Generic How to Split String based on delimiter in Java? Difference between Right shift and Unsigned right What is the maximum Heap Size of 32 bit or bit How to set in Eclipse I How to add and substract days in current date in J Java Program to find factorial of number in Java Difference between Stub and Mock object in Java Un How to Compare Two Enum in Java?
Difference Between Abstract Class vs Interface in What is String args[] Argument in Java Main metho Java Program to print Prime numbers in Java - Exa Pages Privacy Policy Terms and Conditions. Copyright by Javin Paul All subtypes of a serializable class are themselves serializable.
A remote object is an object which is stored at one machine and accessed from another machine. So, to make an object a remote object, we need to flag it with Remote interface. Here, Remote interface serves to identify interfaces whose methods may be invoked from a non-local virtual machine.
Any object that is a remote object must directly or indirectly implement this interface. RMI Remote Method Invocation provides some convenience classes that remote object implementations can extend which facilitate remote object creation. This article is contributed by Gaurav Miglani. If you like GeeksforGeeks and would like to contribute, you can also write an article using write. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above. Skip to content. Change Language. Related Articles. Basics of Java. Operators in Java. Packages in Java. Flow Control in Java. Loops in Java. Jump Statements in Java. An interface that does not contain methods, fields, and constants is known as marker interface. In other words, an empty interface is known as marker interface or tag interface. It delivers the run-time type information about an object.
It is the reason that the JVM and compiler have additional information about an object. The Serializable and Cloneable interfaces are the example of marker interface. In short, it indicates a signal or command to the JVM. The declaration of marker interface is the same as interface in Java but the interface must be empty.
For example:. There are the two alternatives of marker interface that produces the same result as the marker interface. Marker interface is used as a tag that inform the Java compiler by a message so that it can add some special behavior to the class implementing it. Java marker interface are useful if we have information about the class and that information never changes, in such cases, we use marker interface represent to represent the same.
Implementing an empty interface tells the compiler to do some operations. It is used to logically divide the code and a good way to categorize code. It is more useful for developing API and in frameworks like Spring. In Java , built-in marker interfaces are the interfaces that are already present in the JDK and ready to use. There are many built-in marker interfaces some of them are:. Cleanable interface in Java is also a marker interface that belong to java.
It generates replica copy of an object with different name. We can implement the interface in the class of which class object to be cloned. It indicates the clone method of the Object class. If we do not implement the Cloneable interface in the class and invokes the clone method, it throws the ClassNotSupportedException. Note that a class that implements the Cloneable interface must override the clone method with a public method.
Let's see an example. It is a marker interface in Java that is defined in the java. If we want to make the class serializable, we must implement the Serializable interface. If a class implements the Serializable interface, we can serialize or deserialize the state of an object of that class.
Serialization converting an object into byte stream is a mechanism in which object state is read from the memory and written into a file or database. Deserialization converting byte stream into an object is the opposite of serialization means that object state reading from a file or database and written back into memory is called deserialization of object.
Serialization writing can be achieved with the ObjectOutputStream class and deserialization reading can be achieved with the ObjectInputStream class.
0コメント