Interview
- 28 July
Inheritance in Java
In this post, we will see about Inheritance in java. It is one of the OOPs principles apart from Abstraction, encapsulation and polymorphism. Introduction The word Inheritance is quite familiar with everyone. In common terms, the word means the bequeathing of property and characteristics from generation to generation. For example, the property or characteristics of […]
- 13 June
Java Executor framework tutorial with example
Java 5 has introduced new framework called Executor Framework for managing threads.We have already seen before how to create a thread. If you have noted, we need to create an object of thread class using new Thread(runnableObject), so we need to create thread object for each task.Imagine a situation where you have thousands of task […]
- 10 June
Java Interview Programs for Logic Building
In this tutorial, we will see Java interview programs for logic building. These java programs will help students to crack Java interview. Here is the list of Top 10 Java interview programs for logic building. Question 1: Check if number is odd or even? Answer: It is a very basic question. You need to check […]
- 06 June
Top 10 Java tricky interview questions
In this tutorial, we will see top 10 Java interview questions. If you can solve these questions, it will help you to understand java programming better.You can also go through top 50 core java interview questions and answers. Question 1: What will be the output of below program: [crayon-676853f44a450340743399/] Question 2: Guess the output of below […]
- 05 June
Java newSingleThreadExecutor example
In this tutorial, we will learn about Executor’s newSingleThreadExecutor factory method. In the last tutorial, I have shared an introduction to ThreadPoolExecutor. If you are not aware of concepts of ThreadPoolExecutor, you should go through that first. Executor’s newSingleThreadExecutor factory method : This method returns thread pool executor which executes one task at a time.If […]
- 29 May
Java ScheduledThreadPoolExecutor Example
There are multiple ways to schedule a task in java. We have already Java timer to schedule a task but the problem with timers task is that you can execute one task at a time.So if the current task takes longer subsequent job will be delayed. In this scenario, you can use Java ScheduledThreadPoolExecutor.This class […]
- 27 May
Polymorphism in java with example
In this tutorial, we will see about Polymorphism in java. Polymorphism in java is one of core Object oriented programming concepts with Abstraction, encapsulation, and inheritance. Polymorphism means one name many forms. In Java, polymorphism can be achieved by method overloading and method overriding. There are two types of polymorphism in java. Compile time polymorphism. Run […]
- 20 May
Java newFixedThreadPool Example
In this tutorial, we will learn about Executor’s newFixedThreadPool factory method. In the last tutorial, I have shared an introduction to ThreadPoolExecutor. If you are not aware of concepts of ThreadPoolExecutor, you should go through that first. Executor’s newFixedThreadPool factory method : This method returns ThreadPoolExecutor whose maximum size(let’s say n threads) is fixed.If all […]
- 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 […]