---
title: "What is a rules for defining annotation types"  
description: "What is a rules for defining annotation types"  
author: "Jonas Stuart"  
published: 2016-07-15  
updated: 2020-09-20  
canonical: https://www.mindstick.com/interview/23028/what-is-a-rules-for-defining-annotation-types  
category: "java"  
tags: ["java", "java i/o"]  
reading_time: 1 minute  

---

# What is a rules for defining annotation types

· An annotation declaration starts with @interface, followed by the annotation’s name.\

· To create parameters for an annotation, you declare methods in its type.

· Method declarations should not contain any parameters.

· Method declarations should not contain any throws clauses.

## Return types of the method should be one of the following:

- Primitive
- String
- Class
- Enum

## Answers

### Answer by Jonas Stuart

· An annotation declaration starts with @interface, followed by the annotation’s name.\

· To create parameters for an annotation, you declare methods in its type.

· Method declarations should not contain any parameters.

· Method declarations should not contain any throws clauses.

## Return types of the method should be one of the following:

- Primitive
- String
- Class
- Enum


---

Original Source: https://www.mindstick.com/interview/23028/what-is-a-rules-for-defining-annotation-types

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
