METHO is not accessible outside of that method. D LEVEL All variables declared inside SCOPE methods are visible from the beginning of their declaration to the end of the method. public class Main { public static void main(String[] args) { // code here cannot use x Here is an int x = 100; example // code here can use x code: System.out.println(x); } } public class Main { public static int myMethod(int arg) { int x = 100; //local method variable return x + arg; Here is } another public static void main(String[] args) { example: System.out.println(myMethod(5)); System.out.println(myMethod(17)); } } Activity: public class Main { public static int myMethod(int arg) { return x + arg; int x = 70; } public static void main(String[] args) { System.out.println(myMethod(5));
Fix the following code to get System.out.println(myMethod(17));