0
Plz help me to fix the error?
import java.util.Scanner; public class my { static void say(String x) { System.out.println(x); } public class Program { Scanner a = new Scanner(System.in); String b = a.nextLine(); say(b); public static void main(String[] args) { } }
2 Answers
+ 2
First, closing bracket is missing in first class
Second, the code you wrote in class Program should be inside main.
Third, you can't call method of another class like that. Either create an object or call it using Class name since it is static. So, It should go like My.say(b);
0
My.say(b);
if you rename class my to My , it is recommended