Java Classes | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Java Classes

Trying to set constant values to the name and age and its not working. here is what I got so far public class Person{ public static String DEFAULT_NAME = ""; public static int DEFAULT_AGE = 0; public String name; public int age; public Person(String name, int age){ this.name = name; this.age = age; } public String getName(){ return name; } public void setName(String name){ this.name = name; } public int getAge(){ return age; } public void setAge(int age){ this.age = age; } }

9th Apr 2019, 6:32 PM
Albert Yakubov
Albert Yakubov - avatar
1 Answer
+ 5
Please choose which thread to keep on this question to avoid duplicate threads. https://www.sololearn.com/Discuss/1752404/?ref=app
9th Apr 2019, 6:59 PM
Ipang