Plz help me to fix the problem below | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Plz help me to fix the problem below

public class Person { public static void main(String[] args) { Person p = new Person(); p.setAge(25); change(p); System.out.println (p.getAge()); } static void change(Person p) { p.setAge (10); } }

25th Jun 2019, 5:03 PM
Boy Arya
Boy Arya - avatar
3 Réponses
+ 1
Uhhh... you don't have an age attribute, setAge function, or getAge function defined, that could be the problem. You also don't have a person constructor.
25th Jun 2019, 5:09 PM
Jackson O’Donnell
0
Thnks all for the help
25th Jun 2019, 5:39 PM
Boy Arya
Boy Arya - avatar