Java - Object-Oriented Programming Concepts
What will be the output of the following code?
class Dog {
String name;
void bark() {
System.out.println(name + " says Woof!");
}
}
public class Main {
public static void main(String[] args) {
Dog dog1 = new Dog();
dog1.name = "Buddy";
dog1.bark();
}
}