Core Java Archive

Finally Block in Java

Finally: ‘finally’ is a keyword. ‘finally’ is a block of statements. ‘finally’ block is used to release(close) any resource connected to program. Finally block executes whether or not an exception has raised in try block. …

Checked Exceptions in Java

Unchecked v/s Checked exceptions: Exceptions classified into Checked and Unchecked. Unchecked exceptions handling is optional. Checked exceptions must be handled else compiler raises error. Unchecked Exceptions: The child class of RuntimeException is called Unchecked. Examples… …

throw keyword in java

Throw: It is a keyword. It is used to throw an exception object explicitly by the programmer. Pre-defined exceptions will be raised(thrown) by JVM automatically. Custom exception must be raised manually by the programmer. If …

Custom exceptions in Java

Custom Exceptions: Java API providing pre-defined exception classes. Every programmer can define user exceptions also. A custom exception extends the functionality from pre-defined exception classes. Custom exception can be either Checked or Unchecked. Most of …

throws in java

throws: ‘throws’ is a keyword. It is used to specify that a method raises exception from its definition. It is useful to pass the exertion handling process to method calling area when we don’t handle …

Application using java exceptions

Usage of Exception in General applications: Following program code explains the situation of getting and handling exception while performing money transaction (withdraw) operation in ATM application.

Multi threading in java

Multi Tasking: Performing more than one task simultaneously. In computer, every instruction execute by the processor. Processor can execute only 1 instruction at a time. When we try to perform multi tasking, processor space will …

Main thread in java

Thread applications: Single threaded application Multi threaded application Single Threaded application: Every application starts with a Default thread called “main”. When we invoke the application, JVM create and starts the thread. In single threaded application, …

Create Thread in java

Creating Thread: java.lang package providing class and interface to create Thread. java.lang.Thread class java.lang.Runnable interface We can extends from Thread class or Implementing from Runnable interface. We need to override run() method to place the …

Courses Enquiry Form