I am unable to resolve this error plz help me out? What to do? how to resolve this issue?
Asked
Active
Viewed 612 times
0
-
You need **count** to be a global variable – null_override Sep 08 '20 at 17:34
-
Please read [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask) and [How to create a Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) and especially you shouldn't post code as an image. Code fragments should be included as text so everybody can copy and paste it to their own IDE. – vanje Sep 08 '20 at 17:40
1 Answers
0
count is declared inside the scope of the loop, so it is not accessible by the outside. you need to declare it as a local variable (in the scope of the entire class).

Ralph Aouad
- 414
- 4
- 10
-
These is no *global variable* concept, as such, in Java. Method variables are *local variables* and class variables have different visibility, depending on their access modifiers. – Giorgi Tsiklauri Sep 08 '20 at 17:37
-