Local Variable: a local variable is typically used inside a method, constructor, or a block and has only local scope. Thus, this variable can be used only within the scope of a block. The best benefit of having a local variable is that other methods in the class wont be even aware of that variable.
Instance Variable: a variable which is bounded to its object itself. These variables are declared within a class, but outside a method. Every object of that class will create its own copy of the variable while using it. Thus, any changes made to the variable wont reflect in any other instances of that class and will be bound to that particular instance only.
Java Concepts • Added 10 months ago
* In Java, string objects are immutable in nature which simply means once the String object is created its state cannot be modified. * Whenever you ...
In Java, super() and this(), both are special keywords that are used to call the constructor. __this:__ 1. this() represents the current instan ...
* __Equals()__ method is defined in Object class in Java and used for checking equality of two objects defined by business logic. * __''==''__ or dou ...
__final__ is a special keyword in Java that is used as a non-access modifier. A final variable can be used in different contexts such as final variabl ...
Signature of main() method: ``` public static void main(String[] args) { // code comes here } ``` __Public__: It is an Access modifier, ...