Answers for "Static and Instance Variable?"

0

Static and Instance Variable?

Different is number of the copies are different.
Instance are belongs to object from one class 
you can have multiple objects. If u have multiple 
objects and if you want to each of the object a own 
value that is time you need to use instance variable.
If you want to all object have same value, you will use static. 
Static is a global and you can call anywhere. 
Static run only 1 time. 1 copy.
Static block – Instance Block what difference between them? 
Both of them initializing static and instance variables.
Static Block if it takes multiple steps, you can use static block.
Get the file, read the file, set the variable. 
You can set these 3 steps In the Block, once. 
Complete the multiple steps one time. 
Instance Block; it is going to run depend of the object. 
If you have 10 object it is going to run 10 times.
Posted by: Guest on May-28-2021

Code answers related to "Static and Instance Variable?"

Browse Popular Code Answers by Language