Java OOPs Concepts

we will help you to understand about Java OOP’S concepts with examples. oops concepts in java

Difference between this and this() in Java with Example

In Java, both this and this() are entirely different with different functionalities. Functionalities (Purposes) this keyword is used to refer always current object this() is used to access one constructor from another where both constructors belong to the same class Following table illustrates the differences. this keyword this() Used with objects only Used with constructors …

Difference between this and this() in Java with Example Read More »

Method overloading vs Method Overriding Java

Method overloading and method overriding are two concepts supported by a OOPs language. Method overloading Definition: Using the same method number of times in the same class but with different parameters is known as method overloading. Advantages: The same method call gives different outputs when called different times. For example, getArea() method may give sometimes …

Method overloading vs Method Overriding Java Read More »

Java Tutorial: Constructor Overloading with Example

We know earlier what is a constructor, default constructor, types of constructors and their advantages and place in Java language. Let us know one more concept of constructors known as constructor overloading. Like method overloading, Java also supports constructor overloading. Writing multiple constructors, with different parameters, in the same class is known as constructor overloading. …

Java Tutorial: Constructor Overloading with Example Read More »

Constructors Java: Learn through Questions and Answers

One of the simplest methodologies of learning a subject is through Questions/Answers. I believe in this. 17 questions with answers on Constructors Java are given. 1. What is constructor? 2. Define constructor in Java? 3. What is class constructor in Java? 4. What is the return of constructor? One of the Java constructs (with which …

Constructors Java: Learn through Questions and Answers Read More »

Can we create abstract class object ?

Abstract class object: Put the same question for an interface. Everyone says anonymously, "no" because there is no implementation (body) of methods as all are abstract. But what about with abstract class? Coming to an abstract class, the question arises as one variation of abstract class is that it can contain all concrete methods. I …

Can we create abstract class object ? Read More »

Java Encapsulation Abstraction Data hiding and Data binding

Java Encapsulation : In an object-oriented programming language, Encapsulation, Abstraction, Data hiding and Data binding are very confusing words, everyone feels difficult to understand. Many Web sites discuss at length and finally one site contradicts slightly with the other with many user comments of what they feel. Here I give in my own style of …

Java Encapsulation Abstraction Data hiding and Data binding Read More »

Call Constructor from Constructor Java

Calling Constructor from Constructor requires precautions on usage. Read and understand carefully. What is a constructor and what is its role in programming? A constructor is that one which is called implicitly when an object is created in Java. A constructor gives properties to an object while it is being created itself. Else, separate methods …

Call Constructor from Constructor Java Read More »

Access Specifier vs Access Modifier Java

Access Specifier vs Access Modifier: For a novice, both the words specifier and modifier looks one and the same and may be confusing. If you go by the literal meaning, it is more confusing, say, an access specifier specifies the access and access modifier modifies the access. Of course, if the meaning and functionality is …

Access Specifier vs Access Modifier Java Read More »

Java Extends vs Implements

Java uses two keywords to inherit – extends and implements. The difference of them and their usage is trivial to understand. Introduction Java Extends vs Implements Go through the following combinations and rules one-by-one. Write small programs and practice. It is required to master them for a better Developer. 1. Inheritance between concrete (non-abstract) and …

Java Extends vs Implements Read More »