tag

home / developersection / tag

Nested Classes in Java: Demonstrating Use of Inner Classes
java 19-May-2016
Nested Classes in Java: Demonstrating Use of Inner Classes

uppose we are required to create an application that generates a random list of odd numbers. The list itself should consist of a random number of entr

Creating a Copy Constructor
java 19-May-2016
Creating a Copy Constructor

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.

Java Access Modifiers: The protected and default Modifiers
java 17-May-2016
Java Access Modifiers: The protected and default Modifiers

The protected ModifierGoing back to our asset management example, we have defined several classes that lie in a single hierarchy. The Asset, BankAccou

Java Access Modifiers: The public and the private Modifiers
java 17-May-2016
Java Access Modifiers: The public and the private Modifiers

The public ModifierPreviously we understand the visibility of members at certain level using access modifiers in java. Now here we see public modifier

Visibility Modes and Access Modifiers in Java
java 17-May-2016
Visibility Modes and Access Modifiers in Java

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

Understanding Member Visibility Rules
c# 17-May-2016
Understanding Member Visibility Rules

In the examples so far, we have seen the use of the public and private keywords. These are access modifiers that control the visibility of fields, methods, and classes in the scope of the entire application.

The final keyword: final variable of class type
java 17-May-2016
The final keyword: final variable of class type

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.

The final keyword: final methods
java 17-May-2016
The final keyword: final methods

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.

Package Statements in java
java 16-May-2016
Package Statements in java

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:

Inheritance in Java: What is Inheritance?
java 16-May-2016
Inheritance in Java: What is Inheritance?

All of us have observed inheritance in nature. For example, a baby inherits the characteristics of her parents; a child plant inherits the characteristics of its parent plant, and so on.

Inheritance in Java: Object Creation Process
java 16-May-2016
Inheritance in Java: Object Creation Process

To better understand the object-creation process, let’s begin with a simple case of two-level inheritance, where we have just a base class and its derived class.

Method Overloading
java 16-May-2016
Method Overloading

In our example of the previous post, the classes Asset, BankAccount, and SavingsAccount defined two constructors. Both constructors obviously have the