Witscale Test Center

Method Overloading & Overriding


Method Overloading & Overriding

 

Text Box: 11
Method Overloading & Overriding


This chapter covers…

Ñ	Benefits of encapsulation
Ñ	IS-A and HAS-A relationships
Ñ	Method overloading
Ñ	Method overriding
Ñ	Constructor Overloading

The SCJP Handbook


 

This chapter discusses some important (from the exam perspective) object-oriented concepts and how to implement them in Java. To be a good Java programmer, you must have a solid understanding of object-oriented concepts and good knowledge of the features that Java language provides to implement them. Remember that Java is a hybrid language. Therefore, you can also do procedural programming in Java. However, Java is inherently object-oriented language and its full benefits are realized only when you use it as an object-oriented language. Using it as procedural language would ruin the benefits of both approaches. You are likely to use the object-oriented features of Java when you are fully convinced of its benefits. This chapter (and chapter 2) will try to do just that by answering some of the why’s and how’s of using Java as an object-oriented language. Note that object-oriented paradigm is a vast topic. The complete discussion on its concepts is beyond the scope of this book. We will focus on exam-specific aspects only.

The sixth exam objective expects you to know and implement object-oriented concepts of encapsulation, inheritance and polymorphism. You should also be able to identify whether the given Java code implements these concepts correctly. This objective specifically expects you to know two basic feature of OO, encapsulation (6.1) and inheritance (6.2). We will also look into the benefits of implementing these features in your Java code.