0

Why does it give such errors? Please help

https://code.sololearn.com/c9srRy95aAxY/?ref=app

11th Feb 2021, 2:23 AM
Aman sharma
5 Réponses
+ 3
public class Program { public static void hi(String n) { System.out.print(n); } public static void main(String[] args) { hi("Hey"); } } Like this it works
11th Feb 2021, 2:34 AM
Nassera
Nassera - avatar
+ 2
You cannot declare a function inside a function.
11th Feb 2021, 2:30 AM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 1
Because u re declaring ur method inside the method main instead u have to declare it inside the class and then you can call it from the main u got me ?
11th Feb 2021, 2:32 AM
Nassera
Nassera - avatar
0
yes mam, Thank you Nassera
12th Feb 2021, 2:48 AM
Aman sharma
- 1
CarrieForle We cannot declare functions inside main method?
12th Feb 2021, 2:48 AM
Aman sharma