0 votes
1 view
in Java by (2.4k points)

1 Answer

0 votes
by (5.4k points)
edited by
The biggest restriction is that a static function CANNOT call a non-static data member or function without creating an instance to achieve that. This is why, in main functions, we create objects of classes to use any non-static data member.

Secondly, keywords such as 'this' and 'super' can't be used in the static context and are only relevant when multiple instances of a class exist. This means that even if you create objects of a class and try to use the aforementioned keywords since we are not actually instantiating the data members, an error will be thrown.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...