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!
New course! Every coder should learn Generative AI!
Try a free lesson
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 Answer
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