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

What is polymorphism in Java ? | Interview Question – Nicely answered

Answer includes, what is polymorphism in java and how polymorphism achieved in java oops and a format how to answer this question in a technical interview to make impressive answer. NOTE: On asking what is polymorphism in java technical interview questions, many people just give one line answer that polymorphism in java is the ability…

Read the full article

What to prefer if Java Interface and Abstract class have abstract methods only?

Technical interview question is if an Interface and abstract class in java both contains only abstract methods then what would you choose or prefer between java interface and abstract class and why? This is true that abstract class can have a method implemented into it, but, the restriction is that it also contains only abstract class.…

Read the full article

Why to use final method in java programs? – Is it inherited?

Answer: final method in java programs is used to stop being overridden in derived class. However, final method can be inherited in derived class. Note that final methods can be used in any normal class and not only to java final class. In below java code example, Insurance class is the base class that is having…

Read the full article

Can a java abstract class method be final and abstract both?

Answer: No, an abstract class method cannot be final and abstract both in java e.g.     Reason is that, by making a method final in abstract class, we are stopping derived class not to override and implement it. Whereas, by making it abstract, we are forcing derived class to override it and implement it.…

Read the full article

What is thread pool in Java? Explain with a scenario and code.

Answer includes thread pool in java with concept and one simple scenario example and program, where thread pool can be used. Answer: Thread pool is collection of multiple threads that is used to performed large number of tasks simultaneously. Tried to include multiple scenarios for better understating and answering the concept with one scenario is…

Read the full article

Why do we use final class in java? – Is it necessary?

Final class in java programs is used to stop inheritance / extension. If we don’t want a class to be inherited or not to be sub classed then make it as a final in software products/projects. Except extension,  in java final class is used as normal class. Means, we can create objects of the class,…

Read the full article