Home  >  Forum  >  Core Java
Post New Query

How to write our own marker interface

joined on
November 18,2013
Asked on April 04,2014
Can we create marker interface if yes
How to write our own marker interface?
joined on
March 14,2013
Replied on April 25,2014

Marker interface has no method. Java has built-in marker interface like Serializable, Clonable etc that are understand by JVM.
We can create our own marker interface but it has nothing to do with JVM, we can add some checks with

Suppose we have an interface like

interface Marker{    }

class A implements Marker{
      //do some task

class Main{
         public static void main(String[] args){
            A ob = new A()[
             if (ob instanceOf Marker){
                // do some task

Write Answer

Copyright ©2017 concretepage.com, all rights reserved |Privacy Policy | Contact Us