home / developersection / category
For an interface containing several methods, a developer can provide the implementation for some of the methods in a class that implements the interface.
One more benefit of constructor overloading is the ability to create a copy constructor, which allows us to create an object copy from the values of another similar object.
Interface Syntax:An interface uses syntax similar to that of a class declaration. The format of the interface syntax is shown here:Modifiers interface
When we are learning Inheritance, we go through a point that Java does not support multiple inheritance—in other words, a class cannot have two or more super classes. Multiple inheritance has its own advantages and disadvantages.
A static block is executed only once when the class is loaded. Our class may contain multiple static blocks. These are executed in the order in which
We use constructors to initialize non-static fields of a class. The constructors are called at the time of object creation and complete the initializations defined in them before the object becomes ready to use.
The protected ModifierGoing back to our asset management example, we have defined several classes that lie in a single hierarchy. The Asset, BankAccou
The public ModifierPreviously we understand the visibility of members at certain level using access modifiers in java. Now here we see public modifier
We know java uses four access modifiers public, protected, default and private to maintain visibility at various levels. Let’s discuss how to define t
Earlier we created and used variables of the class type that hold references to the objects of those class types. Now, we’ll cover an important situation in which such a variable of the class type is declared final.
Just the way we create final classes, we create final methods that cannot be overridden in the subclasses. To explain the purpose behind this, let’s look at an example.
The package statement allows us to group logically related classes into a single unit. In our earlier programs, we have used import statements such as the following: