What is the output of calling puppy.printInfo()
?
public class App {
public static void main(String[] args) {
Dog puppy = new Dog("Buddy", 1);
puppy.printInfo();
}
}
class Dog {
String name;
int age;
public Dog(String name, int age) {
this.name = name;
this.age = age;
}
public void printInfo() {
String name = "Hello";
System.out.println(this.name + " is " + this.age + " year(s) old.");
}
}