• 02 May

    Encapsulation in java with example

    Encapsulation in java is the process of binding related data(variables) and functionality(methods) into a single unit called class. Encapsulation can be achieved by using access modifier such as public, private, protected or default, so your class will be safe from unauthorized access by others and will be simple to maintain. We can create fully encapsulated […]

  • 27 April

    Abstraction in Java

    1. Introduction Abstraction is a concept of exposing only essential details and hiding implementation details. It is one of the essential OOPs concept apart from encapsulation, inheritance and polymorphism. Abstraction retains only information which is most relevant for the specific purpose. For example: ArrayList stores objects sequentially as list, and you can use the add() method […]

  • 27 April

    Interface in java

    In previous post, we have seen abstract class in java which provides partial abstraction. Interface is one of the core part of java and is used to achieve full abstraction. Interface is generally used to provide contract for class to implement. Interface do not have implementation of any method.A class implements an interface, thereby inheriting […]

  • Java OOPS interview questions
    01 March

    Java OOPS interview questions and answers

    In this post, we will see most important Oops interview questions in java. 1. What are some core concepts of OOPS in java? Core concepts of OOPs are : Polymorphism Abstraction Encapsulation Inheritance 2. What is Abstraction? Abstraction is a concept of showing only important information and hiding its implementation.This is one of the most […]

  • Method overloading and overriding interview questions
    18 February

    Method overloading and overriding interview questions in java

    In this tutorial, we are going to see Method overloading and overriding interview questions. 1. What is method overloading? Answer: If two or more methods have same name, but different argument then it is called method overloading. For example: Array’s sort method have many overloaded versions. You can sort array of double, int, String etc. 2. […]

  • 24 May

    Variable arguments or varargs methods in java

    Java variable arguments was introduced in java 5 and it allows methods to take as many number of arguments you want. Syntax: We use three dots (…) also known as ellipsis to define variable arguments. [crayon-675014046bf06972432526/] There are some points which you need to keep in mind while using varargs methods: You can have only […]

  • 19 June

    Difference between Abstract Class and Interface in java

    Some of the popular interview questions are “What are differences between abstract class and interface“. “When will you use abstract class and when will you use interface“. So in this article ,we will go through this topic. Before going through differences between them, Lets go through its introduction. Abstract class Abstract classes are created to […]

  • 17 June

    Method overloading in java

    If two or more methods have same name , but different argument then it is called method overloading. Why you would do that (same name but different argument)? Lets take an example. You want to print salary of employee and sometimes company gives bonus to their employee and sometimes it don’t.So If company don’t give […]

  • 17 June

    Method overriding in java

    If subclass is having same method as base class then it is known as method overriding Or in another words, If subclass provides specific implementation to any method which is present in its one of parents classes then it is known as method overriding Lets start with a real time example: In a small organization,There […]