¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita0
Java Classes (getters and setters)
Make your data members private and write getters and setters for them. The method names for these should match this pattern getAge() and setAge() . public class Person{ public String name; public int age; public Person(String name, int age){ this.name = name; this.age = age; } }
4 Respuestas
+ 2
https://www.sololearn.com/learn/Java/2154/?ref=app
Read this lesson. If you have troubles with it, you can ask us.
+ 2
Albert Yakubov It works. Try it again, maybe there are server problems.
+ 1
the link is empty
+ 1
I have a code you can checkout which explain Encapsulation:
https://code.sololearn.com/cpAdKz68c2j5/#java