Annotation

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.Date;

/**
 *
 * @author bhavesh
 */

@Retention(RetentionPolicy.CLASS)
@Target(ElementType.TYPE)
public @interface NewAnnotation {
   
    public String name();
    public int myno() default 10;
    //public Date mydate =new Date();
   
   
   
   
}






/**
 *
 * @author bhavesh
 */


class A
{
    public void test()
    {
       
    }
}


class B extends A
{
    @Override
    public void test()
    {
       
    }
}

// Use of annotation called NewAnnotation ....

@NewAnnotation(name="ISTAR")      
public class ClassAnnotationTest {
 
     
}

Comments

Popular posts from this blog

Custom Exception example for BankAccount

Interface with class and interface as member