Adding fields annotation

Report a typo

Define an annotation that would add a version String field to a class. For example, placing it above some class like this:

@Version(value = "1.0")
public class MyClass {...}

You do not need to define annotation processing, just the exact annotation class.

Apply this annotation to TestClass.

Write a program in Java 17
@interface Version {

}

class TestClass {
public void myMethod() {
// some code
}
}
___

Create a free account to access the full topic