Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public @interface Rule {
- static int count = 0;
- String name();
- String description(); //Note the parentheses
- public Rule(String name, String description) {
- count++;
- this.name = name;
- this.description = description;
- }
- }
- public class Airline {
- private String code;
- @Rule(name = "Formatted Code", description = "e.g. Format 'la' as 'LA'")
- public String codeFormatted() {
- return code.toUpperCase();
- }
- public static void main(String args[]) {
- System.out.println(Rule.count);
- }
- }
- javac Rule.java
- Rule.java:6: error: <identifier> expected
- public Rule(String name, String description) {
- ^
- 1 error
- Compilation exited abnormally with code 1 at Thu Mar 22 19:58:39
Add Comment
Please, Sign In to add comment