Variable Hiding in Java

Variable hiding happens when there is another variable with the same name and it has nearest scope. Note : When local and global variables have the same name, local variables will take precedence than global variables. Consider the below program package com.kb.javainsimpleway.variable.hiding;   public class VariableHiding {     int x=100;     public static […]

Share this article on

this keyword in Java

“this” is a reference to the current object within the instance method or constructor. Current object means the object which has called the method or the constructor. We can say “this” is a keyword which holds the address of the current object. We can use “this” to call any member of the current object. Compiler […]

Share this article on
< Previous Next >