+ 1

How can i call static block element through nonstatic block in java?

17th Nov 2016, 4:26 PM
bikash panda
bikash panda - avatar
4 Answers
+ 3
classname.method(Param)
18th Nov 2016, 4:02 AM
Harish Nandoliya
Harish Nandoliya - avatar
+ 2
yes... but we can't call non static from static block(we have to create object)
17th Nov 2016, 6:21 PM
Harish Nandoliya
Harish Nandoliya - avatar
0
I know but how I call through nonstatic block..? Have u any code ?
17th Nov 2016, 6:41 PM
bikash panda
bikash panda - avatar
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.
18th Nov 2016, 1:51 AM
The PGDeveloper
The PGDeveloper - avatar