Output of following Java program?
(B) compiler error
(D) garbage balue
Explanation: main() is a static method and fun() is a non-static method in class Main.
Like C++, in Java calling a non-static function inside a static function is not allowed
Quiz of this Question
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.