try-catch-finally in Java

try, catch and finally keywords are used to handle the exceptions in java The structure of this is as follows: try {                       // code that may throw exceptions   }          //You can’t keep statements here    catch (Exception e)   […]

Share this article on

this keyword in java

The “this” keyword is used to refer to the current instance of a class. Example: public class Employee  {     int age;     public Employee(int age)     {        this.age = age;     }   private void displayEmployee(){     System.out.println("Employee’s age : " + this.age); }   public […]

Share this article on
< Previous Next >