Question: Class, Using the Dog class below, transform the class to encapsulate the data. Provide appropriate getters and setters. public class Dog { String name;

Class, Using the Dog class below, transform the class to encapsulate the data. Provide appropriate getters and setters. public class Dog { String name; String breed; String color; int age; public void barking() { } System.out.println("Dog barks"); public void eating() { } System.out.println("Dog eats"); public void running() { } System.out.println("Dog runs"); } public void wag Tail() { } System.out.println("Dog wags its tail"); public static void main(String[] args) { Dog dog = new Dog(); } dog.setName("Rudy"); dog.setAge(12); System.out.println(dog.getBreed()); System.out.println(dog.getColor());
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
