This example show you how to use the HelloAnnotation
annotation on the previous example code, How do I create a simple annotation?. We add the HelloAnnotation
annotation to our class and its methods.
package org.kodejava.lang.annotation;
@HelloAnnotation(value = "Good Morning", greetTo = "Universe")
public class HelloAnnotationExample {
public static void main(String[] args) {
HelloAnnotationExample hello = new HelloAnnotationExample();
hello.sayHi();
hello.sayHello();
}
@HelloAnnotation(value = "Hi there", greetTo = "Alice")
private void sayHi() {
}
@HelloAnnotation(value = "Hello there", greetTo = "Bob")
private void sayHello() {
}
}
Latest posts by Wayan (see all)
- How do I get the number of processors available to the JVM? - March 29, 2023
- How do I show Spring transaction in log / console? - March 29, 2023
- How do I build simple search page using ZK and Spring Boot? - March 8, 2023