Latest blog tagged on "Class"

In our previous section, of inheritance we have seen how derived class (or child class) inherits the function or methods of base class (or parent class). There can be a situation where you want to prevent a class from being inherited.

PHP
PHP  Class 

Our Point class declared here contains only fields. Now, we will add a method to the Point class which will help us understand the method declaration and calling syntax.

Java  Class 

One of the major benefits of object-oriented programming is code reuse. Programmers develop lot of code over time.

When a running Java application fails, it creates an exception object encapsulating the error condition and throws it back to the running code.

A local class without a name is called an anonymous class. If we need only a single instance of a local class, we will create an anonymous class. Typically, a local class has a name and thus a declaration.

A non-static class defined within a class is called a member class of the enclosing class. A member class is commonly used as a helper class to the enclosing class.

Suppose we are required to create an application that generates a random list of odd numbers.

Java  Nested  Class 

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  Class 

Going back to our asset management example, we have defined several classes that lie in a single hierarchy.

Java  Class 

Previously we understand the visibility of members at certain level using access modifiers. Now here we see public modifier in detail.

Java  Class 

We know java uses four access modifiers public, protected, default and private to maintain visibility at various levels.

Java  Class 

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.

C#
Java  Class 

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.

Java  Class 

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.

Java  Class 

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:

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.

Java  Class 

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.

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

In the previous post, we learned how to create a single-level class hierarchy of an arbitrary depth. We created an asset management system, and the top-level class in this system was Asset.

Array is a collection of similar type of elements that have contiguous memory location. Java array is an object that contains elements of similar data type.

Java  Class 

The java command-line argument is an argument i.e. passed at the time of running the java program.

Executing a Java program which has been saved with different name as that of its class name.

Java  File  Class 

Hi everyone in this blog we will learn about java object and classes.

OOPS  Class 

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!