public class Dog
{
private String name = newString(); // instance variables
private String breed = newString();
private int heightInInches;
public void setName(String n) // mutator method for name
{
name = n;
}
public String getBreed() // accessor method for breed
{
return breed;
}
public void setBreed(String b) // mutator method for breed
{
breed = b;
}
public int getHeight()
{
return heightInInches;
}
public void setHeight(int h) // mutator method for height in inches
{
if(h >= 1 && h <= 40)
{
heightInInches = h;
}
else
{
System.out.print("Invalid height");
}
}
public String toString() // toString method
{
return "Name: " + name + " Breed: " + breed +
" Height: " + heightInInches;
}
} // end of class
Errors:
Dog.java:12: cannot find symbol
symbol : method newString()
location: class Dog
private String name = newString(); // instance variables
^
Dog.java:13: cannot find symbol
symbol : method newString()
location: class Dog
private String breed = newString();
^
2 errors