Which variable inside main method ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Which variable inside main method ?

The variable initialized in the main method is what kind of variable ?

28th Jun 2021, 6:20 AM
Md. Shahriar Kamal Nafiz
Md. Shahriar Kamal Nafiz - avatar
6 Answers
+ 2
Shahriar Kamal Nafiz What is your question? About Local variable you are asking or not
28th Jun 2021, 6:25 AM
RšŸ’ šŸ‡®šŸ‡³
RšŸ’ šŸ‡®šŸ‡³ - avatar
+ 2
Inside the main method Local variable is initialized. For example, Public class Method{ Public static void main(string[args]){ int num = 10; Statements } } num is Local variable Local variable is declared within the scope.
28th Jun 2021, 6:45 AM
RšŸ’ šŸ‡®šŸ‡³
RšŸ’ šŸ‡®šŸ‡³ - avatar
+ 1
Can you share your code
28th Jun 2021, 6:47 AM
RšŸ’ šŸ‡®šŸ‡³
RšŸ’ šŸ‡®šŸ‡³ - avatar
+ 1
to operate on an instance variable, an object must be instantiated. the main method is a static method, so it deals with local variables or static variables. what you can do is instantiate objects and put them to work
28th Jun 2021, 10:02 AM
Ciro Pellegrino
Ciro Pellegrino - avatar
0
yes
28th Jun 2021, 6:27 AM
Md. Shahriar Kamal Nafiz
Md. Shahriar Kamal Nafiz - avatar
0
I was stuck at modifyind instance variable from main
28th Jun 2021, 6:46 AM
Md. Shahriar Kamal Nafiz
Md. Shahriar Kamal Nafiz - avatar