0

why this error?

import java.util.Scanner; class Shubham{ public static void main(System[]args){ Scanner sc=new Scanner(System.in); Shubham Jhunki=new Shubham(); jhunki.eating(); jhunki.dancing(); jhunki.walking(); void eating(){ System.out.println("Jhunki is eating"); } void dancing(){ System.out.println("jhunki is dancing"); } void walking(){ System.out.println("jhunki is walking");} } }

24th Apr 2023, 7:57 PM
Shubham Swaraj 161
Shubham Swaraj 161 - avatar
4 Respuestas
+ 3
Look at public static void main. You put (as argument) System[] args. System is not a datatype. Change it to String[] args and it will work.
24th Apr 2023, 9:07 PM
Ugulberto Sánchez
Ugulberto Sánchez - avatar
+ 3
We have to write the other methods outside of main method in a class And another is you have created a object of your class as Jhunki but while you are calling the method you used jhunki here the J should be capital The object name while calling should be same as while creating
25th Apr 2023, 1:38 AM
Kailash Yandrapu
+ 2
Specify error & what code should do. Surely someone will help
24th Apr 2023, 8:18 PM
Lamron
Lamron - avatar
+ 2
Another one in main method delclaration also wrong you should use String[] args I think there are two more main method declaration you may google as what are the main method delcarations in java
25th Apr 2023, 1:42 AM
Kailash Yandrapu