Chapter:Classes - Other keywords

From Juneday education
Jump to: navigation, search

Meta information about this chapter

Expand using link to the right to see the full content.

Introduction

This lecture is here for completeness. We want to show the students that there are more keywords than fits the scope of this course material. We walk through the most important keywords in groups of functionality.

Purpose

The goal is to inform the students about the keywords we have left out of this course material, as well as saying a few words about the keywords included in the course.

Goal

After this chapter, the student shall understand:

  • What a keyword is and what keywords we consider important for the scope of this course material
  • The basic use of most keywords

Instructions to the teacher

Common problems

Some students don't understand what a keyword is. Explain that a keyword is a word with a special, predefined meaning in the Java programming language. All keywords have only lower case (which may look weird in some cases like instanceof. You cannot use a keyword for anything else than it was defined for, so identifiers can never use names that are also a keyword. Some editors color keywords in a different color, to help you avoid trying e.g. to name a variable default.

If the students ask about the more advanced (and more rare) keywords, refer them to the JLS and explain that they are not part of this course material.

Full frontal - Code up-front!

Just some code to get the right mood for this chapter:

public abstract strictfp class Modifiers {
  private static transient volatile boolean makesSense = false;
}

Classes: Other keywords related to elements declared in classes

The following keywords also exist in the Java programming language:

  • volatile (variable modifier)
  • native (method modifier)
  • transient (variable modifier)
  • synchronized (method modifier)
  • protected (access modifier - both variables and methods)
  • strictfp (method, class and interface modifier)
  • and more...

We will not use any of the ones listed above in this course/book (perhaps protected will be used a bit). If you want to read about them, we refer to the Java Language Specification If you want the full list of java keywords, please see here.

Chapters about classes

Here are the chapters about classes in this book, so that you can keep a check on your progress:

Links

Slides and videos

Further reading

Where to go next

Next page has exercises (if any) for this chapter: Classes_-_Other_keywords_-_Exercises

« PreviousBook TOCNext »