Hello why am i getting this errors ?
The constructor Dog() is undefined
The constructor GreyH...
![Computers and Technology](/tpl/images/cats/informatica.png)
Computers and Technology, 24.07.2021 04:30, pinkyglitter3308
Hello why am i getting this errors ?
The constructor Dog() is undefined
The constructor GreyHound() is undefined.
Is there something wrong with how i defined my constructors ?
Here's my code :
public class Dog {
// Creating the variables
private String name;
private String color;
private int birthYear;
// Constructor
public Dog(String name, String color, int birthYear) {
}
// Getters and Setters
public void setname(String name){
this. name = name;
}
public String getname(){
return name;
}
public void setcolor(String color){
this. color = color;
}
public String getcolor(){
return color;
}
public void setbirthYear(int birthYear){
this. birthYear = birthYear;
}
public int getbirthYear(){
return birthYear;
}
public void setraces(int i) {
}
}
// creating a subclass named GreyHound
class GreyHound extends Dog {
private int races;
public GreyHound(int races){
this. races = races;
}
public void setraces(int races){
this. races = races;
}
public int getraces(){
return races;
}
}
// create class named Tester
class Tester{
public static void main(String[] args){
Dog d1 = new Dog();
GreyHound d2 = new GreyHound();
d1.setname("Rolf");
d1.setcolor("Black");
d1.setbirthYear(2010);
d2.setraces(13);
Dog d3 = new Dog ("Bruno","Red",2013);
GreyHound d4 = new GreyHound(13);
Dog d5 = new Dog("Roopi","Silver",2014);
GreyHound d6 = new GreyHound(14);
System. out. println("Name: " + d1.getname());
System. out. println("Color: " + d1.getcolor());
System. out. println("Birth Year: " + d1.getbirthYear());
System. out. println("Number of Races: " + d2.getraces());
System. out. println();
System. out. println("Name: " + d3.getname());
System. out. println("Color: " + d3.getcolor());
System. out. println("Birth Year: " + d3.getbirthYear());
System. out. println("Number of Races: " + d4.getraces());
System. out. println();
System. out. println("Name: " + d5.getname());
System. out. println("Color: " + d5.getcolor());
System. out. println("Birth Year: " + d5.getbirthYear());
System. out. println("Number of Races: " + d6.getraces());
}
}
![answer](/tpl/images/cats/otvet.png)
Answers: 2
Other questions on the subject: Computers and Technology
![image](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 14:30, naomi20044
Select the correct answer. andy received a potentially infected email that was advertising products. andy is at risk of which type of security threat? a. spoofing b. sniffing c. spamming d. phishing e. typo-squatting
Answers: 2
![image](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 14:30, rose6038
Select the correct answer. peter has launched a website that features baby products. however, clients often find they are unable to access the website because the server is down. which feature of cybersecurity should peter focus on for his website? a. data authenticity b. data privacy c. data availability d. data integrity e. data encryption
Answers: 3
![image](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 01:00, gymnast8900
Me if you do then you get 10 points and brainliest
Answers: 1
![image](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 09:00, lisacarter0804
Why might you chose to crest a function resume
Answers: 1
Do you know the correct answer?
Questions in other subjects:
![Konu](/tpl/images/cats/himiya.png)
![Konu](/tpl/images/cats/mat.png)
![Konu](/tpl/images/cats/mat.png)
![Konu](/tpl/images/cats/mat.png)
![Konu](/tpl/images/cats/es.png)
Spanish, 15.08.2020 06:01
![Konu](/tpl/images/cats/mat.png)
![Konu](/tpl/images/cats/ekonomika.png)
![Konu](/tpl/images/cats/himiya.png)
![Konu](/tpl/images/cats/ekonomika.png)