Posts

Showing posts from July, 2020

Multithreading & Synchronization

Multithreading: Execution of more than one thread at a time is called as multithreading. Thread: A thread is a piece of code that executes independently. Every program contains at least one thread. i.e. main thread Main thread default name is main only. Main thread default priority is normal priority(Priority number is 5) There are two ways to create a new thread: 1)    By extending java.lang.Thread class 2)    By implementing a java.lang.Runnable interface Life cycle of a thread (or) thread states: Whenever thread class constructor is called new thread will born. Thread comes to a ready state whenever start() method is called. Thread will run whenever run() method is called. Thread comes to a sleeping state whenever sleep() method is called. Sleeping thread will wake up automatically whenever time interval is finished. Thread is suspended whenever suspend() method is called. Suspended thread will run whe...

Collections Framework

Collections Framework: A set of collection classes and interfaces is called as collections framework.                                                   (or) A set of data structures related classes and interfaces is called as collections framework. Collection: A collection is an object that represents group of objects. Data Structures: Arranging data in different formats is called data structures. Advantages of Collections Framework: 1) Reduces programming effort 2) Increases programming speed & quality 3) Allows interoperability among unrelated APIs. Collection classes & interfaces are the part of java.util package. java.util package classes & interfaces are divided into two categories: 1) Collecti...