Plz correcty mistakes here | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

Plz correcty mistakes here

package person; public class person { public static void main(String[] args) { string name; char sex; int sex; voidtellsex() { if (sex =='m') System.out.println("i am male"); else if (sex == 'f') System.out.println("i am female"); else System.out.ptintln("i dont know"); } void tellage () { if (age <10) System.out.println("i am just a kid."); else if (age < 20) System.out.println("i am a teenager"); else System.out.println("i am grown up"); } }

19th Jun 2018, 2:41 PM
Folorunsho Shamsudeen
Folorunsho Shamsudeen - avatar
2 Respuestas
+ 2
1) You must define all atrribute in class scope not in main function scope 2) You have two attribute with same name (sex) 3) it think that with voidtellsex you want void tellsex 4) Methods must be defined in class scope and not in main
19th Jun 2018, 2:47 PM
KrOW
KrOW - avatar
+ 1
thank u krow
11th Jul 2018, 6:57 AM
Folorunsho Shamsudeen
Folorunsho Shamsudeen - avatar