Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

Treehouse

Java Annotations Course (How To)

via Treehouse

Overview

Annotations have rapidly become the preferred approach to integrating powerful third-party libraries into your own Java applications. In this course, we'll first explore the basic use of annotations to give the compiler instructions. Then, we'll use more advanced techniques to create our own annotation and look for it using reflection.

Syllabus

Using Java's Built-In Annotations

Java includes some built-in annotations to give the compiler instructions. In this stage, we'll explore the use of these three annotations: @Override, @Deprecated, and @SuppressWarnings.

Chevron 17 steps
  • Introduction to Annotations

    2:16

  • Getting Started with Annotations

    1 question

  • The @Override Annotation

    4:49

  • The @Override Annotation

    1 question

  • Adding the @Override Annotation

    1 objective

  • Using @Override to Fix an Error

    1 objective

  • The @Deprecated Annotation

    3:31

  • The @Deprecated Annotation

    1 question

  • Using the @Deprecated Annotation

    1 objective

  • Intro to Command Line Options for the Java Compiler

    3:48

  • Command Line Options for the Java Compiler

    2 questions

  • Using the Directory and Xlint Command Line Options

    5:11

  • Using the Directory and Xlint Options in the Command Line

    2 questions

  • The @SuppressWarnings Annotation - "static"

    4:40

  • The @SuppressWarnings Annotation - "static"

    1 objective

  • The @SuppressWarnings Annotation - "fallthrough"

    5:30

  • The @SuppressWarnings Annotation - Suppressing Multiple Warnings

    1 objective

Writing Your Own Annotation

Understanding exactly how an annotation is coded and used is critical to fully leveraging the power of popular third-party libraries. During this stage, we'll create our own annotation, apply it to a class and some methods, and test for its presence using a programming technique called reflection.

Chevron 13 steps
  • Project Overview: Docgen

    3:48

  • Starting the Annotation - Declaration and Retention

    4:15

  • Declaring an Annotation

    1 question

  • Declaring an Annotation

    2 objectives

  • Finishing the Annotation - Targets and Elements

    4:01

  • Adding Annotation Targets and Elements

    2 objectives

  • Using a Custom Annotation

    3:20

  • Applying an Annotation

    3 questions

  • Introduction to Reflection

    11:40

  • Reflection Basics

    2 questions

  • Reflection Basics

    2 objectives

  • Using Reflection on Our Annotation

    9:06

  • Putting It All Together

    4 objectives

Reviews

Start your review of Java Annotations Course (How To)

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.