The following was submitted under the original assignment of write small program that uses dynamic binding.. now
Question:
The following was submitted under the original assignment of "write small program that uses dynamic binding".. now what is requested is to suggest another way to take advantage of the dynamic biding in the code. Can you please suggest?
import java.util.Scanner;
public class WK6AlhabashiR { public static class House{ private static final String Rooms = null;
void Rooms(String Rooms) { System.out.println ("The house has : " +Rooms + " Rooms"); } public static class Bathrooms extends House{ void level(String Rooms) { System.out.println("Your house has: " +Rooms + " Bathrooms"); } } public static void main(String args[]) { Scanner myObj = new Scanner(System.in); System.out.println("Please enter in the number of Rooms the house has: "); String steps = myObj.nextLine(); House Bathrooms=new Bathrooms(); // dynamic binding Bathrooms.Rooms(steps);
} } }
An Experiential Introduction To Principles Of Programming Languages
ISBN: 9780262045452
1st Edition
Authors: Hridesh Rajan