static is a one of data storage class .whenever we declared the variable as static the value of variable is not changed. i.e the scope of varible is entire program ex: int static a ; { a=1 while(a>0) { a=a+2; } printf("%d",a); } in the above program the value of "a" is each time incremented by 2.it does not reintialise to 1 each time
WE can call a function in many ways 1)we can call it using fname 2)in c++ we can call it using object also 3)using friend functions we call them normally 4)in java there is another advantage in calling a function i.e using STATIC keyword for example: class demo { void A() { Syste.out.println("kishore"); } static void B { Syste.out.println("reddy"); } public static void main(String a[]) { demo d; d.A(); B(); } }
So here the function with static keyword is called directly with out using object and '.' operator.