Witscale Test Center

SCJP Objectives covered


SCJP Objectives covered

Section 1: Declarations and access control

 

1.2 Declare classes, nested classes, methods, instance variables, static variables and automatic (method local) variables making appropriate use of all permitted modifiers (such as public, final, static, abstract, etc.). State the significance of each of these modifiers both singly and in combination and state the effect of package relationships on declared items qualified by these modifiers.

 

1.3 For a given class, determine if a default constructor will be created and if so, state the prototype of that constructor.

 

 

 

When you start writing an application, you may first write the Java code for classes with member variables, and methods. You might as well organize these classes in packages. However, as your application grows, you may face situations where you want to specify certain restrictions on these declarations. Say, for example, you might want to restrict who can access a particular class or you might want to define a class that cannot have any subclasses. How will you do that? Java provides a mechanism called a modifiers to specify these kinds of behavioral restrictions. You can think of modifiers as tags to denote restrictions. Modifiers come in different flavors depending on the kind of restrictions you want to impose.

       In this chapter, you will learn how modifiers affect classes and their members, and how to use them appropriately. SCJP requires deep understanding of modifiers, their applicability, and their proper use. Specifically, this chapter covers section 1.2 (partially) and 1.3 of the first SCJP objective. Nested classes which is part of section 1.2 will be covered in the next chapter.