0
Complete the program below to make class Dog declare a constructor that has one (1) parameter and assigns it to the private age
class Dog {
4 ответов
+ 2
By seeing your tags, I think here what you want,
class dog{
//Here is private field
private int age;
//Constructor of class dog with a parameter
public dog(int age){
this.age=age;
}
}
For more,
https://www.sololearn.com/discuss/204290/?ref=app
https://www.sololearn.com/discuss/1801634/?ref=app
https://www.sololearn.com/discuss/71724/?ref=app
https://www.sololearn.com/discuss/1323930/?ref=app
+ 1
Thanks to you all. Yeah I'm not started any course yet.
+ 1
Don't post homeworks in Q/A.
Thank you.
- 1
to declare a constructor that has one parameter and assigns it to the age member: