As static method can access only static data members & methods so how we can manipulate non-static data inside main method ? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

As static method can access only static data members & methods so how we can manipulate non-static data inside main method ?

public static void main(String[] args) {}

14th Jan 2017, 10:11 AM
Atish Kadu
Atish Kadu - avatar
1 Respuesta
0
Main method cannot access non-static data within its block. If we try to do so compiler will throw an error saying 'cannot access non-static data from static context'.. !!
14th Jan 2017, 10:41 AM
Atish Kadu
Atish Kadu - avatar