Latest article tagged on "Class"

Class and Object in PHP

Object and class are key part of object oriented programming in PHP. Let’s understand what are classes and objects.

 PHP PHP  Class 
By Andrew Watson posted   9 months ago

Class Concepts in Java: Declaring Constructors

A constructor is a special method that the runtime executes during the object-creation process. In previous parts, we saw that the following statement calls the class constructor:

 Java Java  Class 
By Ailsa Singh posted   10 months ago

Nested Classes in Java: More with Inner Classes

If an inner class is declared with a public access modifier, it can be instantiated from outside the scope of its enclosing class.

By Jayden Bell posted   10 months ago

Nested Classes in Java: Classifications of Nested Classes

To create a static nested class, we use the static keyword in front of the class declaration, the same way we declare a static field or a method within the enclosing class. Just like a static method cannot refer to the non-static members of the enclo

By Jayden Bell posted   10 months ago

The static Keyword: The static fields

We have already seen the use of the static keyword in our Java programs. In fact, the first program we encountered uses the static keyword, where it was applied to the main method.

 Java Java  Class 
By zack mathews posted   10 months ago

Class Concepts in Java: Parameterized and Default Constructors (Part-5)

After the object is constructed, we may still call its setter methods (provided we defined them in the class definition) to change the value of data members to any other value.

 Java Java  Class 
By Simond Gear posted   10 months ago

Structure of Java Source Files and Import Statements

We have learned enough from the examples given in previous posts so far to get started writing Java programs. Now, let’s discuss the complete structure of a Java source file. When we write a Java source program, it needs to follow a certain structure

By Allen Scott posted   10 months ago

The final keyword: final classes and variables

So far we have discussed how to inherit from an existing class. However, what if we do not want anybody to inherit from our custom class? We can restrict other developers from extending our classes with the help of the final keyword.

By Royce Roy posted   10 months ago

Inheritance in Java: Calling the super Constructor

To understand how the super keyword is used for calling the superclass constructors, let’s add the constructors to our class hierarchy here

By Jayden Bell posted   10 months ago

Inheritance in Java: Writing a Multi-level Inheritance Program

The application discussed in the previous post is based on the asset management classes we have studied so far. We will now look at the concepts of multilevel inheritance with the help of program code. For this purpose, we will use the asset hierarch

By Allen Scott posted   10 months ago

Java Inner Class

In java Inner class or nested class is declared inside the class or interface. We use inner class because it increases more readable & maintainable of code.

 Java Java  J2EE  Class 
By Anupam Mishra posted   one year ago

Generate random numbers in Java

There are two principal means of generating random (really pseudo-random) numbers: one is using the Random class and the other is using the Math.random method.

 Java Java  Class 


The whole idea behind encapsulation is to hide the implementation details from users. If a data member is private it means it can only be accessed within the same class. No outside class can access private data member (variable) of other class.

Don't want to miss updates? Please click the below button!

Follow MindStick