SCJP Certification

Sun Certified Java Programmer Certification exam essentials

September 25th, 2011

What is coupling?

No Comments, Java Facts, by Daisy Williams.

Coupling is a term that describes the degree to which one module relies on another module for its proper functioning. Coupling is mainly of the following two types:

  • Loose coupling: Loose or weak coupling implies that a change in one module does not require changes in the implementation of another module.
  • Tight coupling: Tight or strong coupling implies that a module relies on another module so strongly that a small change in one will require an implementation change in the other.

For a good object-oriented design, loose coupling is desirable.

Share

September 22nd, 2011

What is polymorphism?

No Comments, Java Facts, by Daisy Williams.

Polymorphism is a feature that allows an interface in Java to be used by many classes for different purposes. The word polymorphism combines poly with morphism, which means many forms. Some examples of polymorphism are overloading and overriding. Polymorphism allows an interface to be used for a general class of actions.

Share

September 20th, 2011

What is constructor overloading?

No Comments, Uncategorized, by Daisy Williams.

Constructor overloading is a technique in Java in which a class can have any number of constructors that differ in parameter lists. A constructor uses its arguments to initialize the new object’s state. The compiler differentiates these constructors by taking into account the number of parameters in the list and their types.

As constructors are not members of a class, they are not inherited by subclasses. Therefore, each of the subclasses must specifically implement any constructors it needs. However, a subclass can use the constructors of its superclass by using the super keyword.

Share

September 17th, 2011

What is inheritance?

No Comments, Java Facts, by Daisy Williams.

Inheritance is a process by which objects of a class acquire the properties of the objects of another class. It supports the concept of hierarchical classification. It not only allows objects to be reused, but also allows the creation of new objects by extending the existing ones. By using the inheritance, a generic class can be created that can then be inherited by other more specific classes. In Java terminology, a class that is inherited is called a superclass, and the class that inherits another class is called a subclass. A subclass inherits all the instance variables (attributes) and methods (operations) defined in the superclass.

In Java, a class is declared to inherit another class by using the extends keyword.

Share