Pages

Monday, May 25, 2020

Exception Handling in Java


What is exception?

Any abnormal condition of a program is called as exception. Handling of such mechanism is called as Exception handling.

Hierarchy of exception is as below:

Hierarchy of exception
Fig: Exception Hierarchy

Tuesday, May 19, 2020

JVM Architecture


JVM is Java Virtual Machine which converts java bytecode (.class file) to native code.

Below figure shows that when the actual working of JVM starts:

Life cycle of Class
Fig.: Life cycle of Class

JVM mainly consist of 3 parts:-

1. Class Loader Subsystem
2. Memory areas
3. Execution engine. 



Wednesday, May 13, 2020

Multithreading in Java

Index:

  1. What is Thread?
  2. Advantages of thread?
  3. How Threads are created in java?  
  4. Difference between Thread class & Runnable interface?
  5. Lifecycle of thread (How thread travels) 


1. What is Thread?


1. Any executable program is called as Thread.

2. Thread is a class in java present in java.lang package

3. Process of executing multiple threads simultaneously is called as MultiThreading.

Consider below example to understanding thread:

MultiProcessing Vs MultiThreading
Example of Multithreading
In above figure, Thread-1 and Thread-2 are executing at a time so it's called as Multithreading.

Monday, May 11, 2020

Top 20 Java Interview Programs

Below programs covered in section:

Fibonacci Series, Armstrong Number, Anagrams Number, Prime Number, Reverse Number / Palindrome Number, Perfect Number, Duplicate Numbers and String/ Word/Characters, Factorial of number,  String Rotation, Binary to Decimal, Largest & Second largest Number, Calculate Sum of All Numbers Contained in String, Find Number of Words in Paragraph, Programs on patterns Of Triangles, Print Pyramid, Number series etc.


Friday, May 8, 2020

Polymorphism in Java

Index of Polymorphism:

1. What is Polymorphism? Explain with realtime example?
2. How to achieve Polymorphism:
3. What is method overloading. 
4. What is method overriding. 
5. What are Diff. betn method overloading & method overriding. 
6. When to use method overloading in realtime Java Project
7. When to use method overriding in realtime Java Project



1. What is Polymorphism? Explain with realtime example?


Ans --> Different behavior at different instance by using same entity is called as Polymorpohism.

Eg. I am acting as software developer in office and acting as son at home. So here there are my 2 behaviors  software developer and son at 2 different places ie. at Office and home by respectively by using same entity (here I am acting as an entity).
Polymorphism in Java

Abstraction in Java

Index:

1. What is Abstraction?
2. How to achieve Abstraction?
3. What is Interface?
4. What is Abstract class ?
5. Difference between Abstract class and Interface.
6. When to use interface, abstract class and concrete class?
7. Advantages of Abstraction.



1. What is Abstraction?

One of the pillar in object oriented programming. Exploring only required things to user. 

E.g.  ATM GUI Screen. We can see all options to check balance, withdraw money etc but can’t see code behind that. This shows that it will explore only required thing to user not internal implementations.


2. How to achieve Abstraction?

Abstraction in OOP can be achieved as below:

How to achieve Abstraction in java?

Thursday, May 7, 2020

Inheritance in Java


In this, we will cover below topics:

1) What is Inheritance
2) How to achieve Inheritance?
3) Types of inheritance
4) Constructor
5) this
6) super


1. What is Inheritance:

1. Inheritance is inheriting features of from parent class to child class is called as Inheritance.
2. In java it can be achieved by using extends keyword.
3.  It is used to achieve Polymorphism.
4. types of inheritance: Simple, Multilevel, Hierarchical, multiple, etc.

Realtime Example:

Let’s CONSIDER below example which will clear the concept of inheritance:
How features transfers using Inheritance

Encapsulation in Java


In this topic will cover all as below:

1. What is Encapsulation?
2. How to achieve of Encapsulation?
3. What are packages and access Modifiers?
4. Advantages of Encapsulation.

1. What is Encapsulation?


Binding of data into single entity is called as Encapsulation.

Encapsulation overview
Fig: Encapsulation Overview