RE: what is the difference between static variables an...
. When we declare a variable as static it means that all objects of that class share this single variable. such variables are global variables.static block or say function means we can access that function before any objects of its class are created and without reference to any object
RE: what is the difference between static variables an...
Static variables belongs to class only and they will execute when they are displayed in System.out.println() statement. By default they have a fixed value. e.g for integer 0 for float 0.0 Static block is executed before main() because it has no need of object to execute this block. As we run program then it will automatically run.