RE: How to call a static block in one class from another class?. And is it possible to call a free floating block in one class from another class?. How?
Non static blocks & Static blocks are executed one by one by the order of their defintion before any constructor is being executed.
Static blocks can also be invoked without creating instance of the Class(without actually calling constructors) by simply loading the Class.
RE: How to call a static block in one class from another class?. And is it possible to call a free floating block in one class from another class?. How?
static block gets executed whenever is class is loaded by the JVM so what you can do is.....
write is class having static block in it ---> compile it --> write another class (ensure that first class is accessible to the second class) and instattiate first class in it ----> your static block will get executed