+ 1
How can i call static block element through nonstatic block in java?
4 Answers
+ 3
classname.method(Param)
+ 2
yes...
but we can't call non static from static block(we have to create object)
0
I know but how I call through nonstatic block..? Have u any code ?
0
You can call a static method in a non-static method. main() method is static method, too.
The following is the syntax:
Class_name.method(argument);
Keep in mind that you must include the class name followed by dot when you call a static method.