Why to use Abstract keyword in java language?

Abstract keyword is used to create an abstract class and abstract methods in java programs. Abstract class: Abstract class in java is used as a base class in inheritance relationship. Abstract class have both non-abstract (implemented methods) and abstract (un-implemented methods) that must be overridden by sub classes. Note that If we want to have…

Read the full article

What are methods of object class in java? – with description

Methods of Object class in java with brief descriptions – The java.lang.Object class is the super class of all classes  whether the class is predefined or user defined class. Object class is by default inherited whether we extend explicitly or not. Methods of object class in java : protected native Object clone() throws CloneNotSupportedException public boolean equals(Object…

Read the full article

What is null pointer exception in java ? How to prevent?

Answer includes, null pointer exception in java with example when it can occur in programs and how we can prevent it. Java interview Question: What is NullPointerException? Tell me some examples when this exception can occur in java programs. How would you prevent null pointer exceptions? Answer: null pointer exception is a run time exception…

Read the full article

Notes on Function Pointer in C – Uses Callback Example

Complete notes on function pointer in C or say pointer to function in C programming – Example of declaration, typedef, real time uses as callback function with program examples. Real life use of call back function is extracted from one of the real product scenario as a pseudo code. Function pointer in C Function pointer…

Read the full article

How do you connect database in java programs?

JDBC driver is used to connect database in java programs. We need to install compatible jdbc drivers for different types of databases i.e. MySQL, Oracle and SQL Server etc. JDBC driver contains classes and interfaces to establish connection between java application and databases. Lets consider an example with simple steps to connect oracle database from…

Read the full article

What is abstraction in java oops? – Easy way

Abstraction in Java is just a concept, and abstraction meaning is “Provide necessary information’s only to clients/users and hide unnecessary details. As an abstraction example, consider a login windows where only User Id and password is enough for users and we don’t need to give responsibilities to users to connect database and validate if credentials…

Read the full article

What is Encapsulation in Java – Best Answer

Answer includes concept of encapsulation in java oops with various java encapsulation examples with programs. Answer: Encapsulation in Java is one of the oops principles that is used for hiding complexities in programs. NOTE: Many candidates answer to this interview question “What is encapsulation in java” like wrapping the class member fields into a method…

Read the full article