Why jvm doesn't allow me to do calc between a static and a non static variable. | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Why jvm doesn't allow me to do calc between a static and a non static variable.

like this static int i=0; int a; a=++i; error occurs when executed. what is the problem because of which jvm doesn't allow me to do this.

25th Mar 2017, 7:42 PM
pranjal kumar
pranjal kumar - avatar
1 Réponse
+ 13
Same reason as here: https://www.sololearn.com/Discuss/276965/?ref=app You don't need static in your example. Leave it out.
26th Mar 2017, 4:10 PM
Tashi N
Tashi N - avatar
Aujourd'hui en vedette
Help
0 Votes
help
0 Votes
About code
1 Votes
Recursion
0 Votes