Where is the constructor and destructor? What is the name of the…
Question Answered step-by-step Where is the constructor and destructor? What is the name of the… Where is the constructor and destructor? What is the name of the array? Is the array an array of objects? public class Food { String name; Food(String name){ this.name = name; }}public class Main{ public static void main(String[] args) { Food[] refrigerator = new Food[4]; Food food1 = new Food(“pizza”); Food food2 = new Food(“hamburger”); Food food3 = new Food(“hotdog”); Food food4 = new Food(“chili”); refrigerator[0] = food1; refrigerator[1] = food2; refrigerator[2] = food3; refrigerator[3] = food4; System.out.println(refrigerator[0].name); System.out.println(refrigerator[1].name); System.out.println(refrigerator[2].name); System.out.println(refrigerator[3].name); }} Computer Science Engineering & Technology Java Programming CSIS 212 Share QuestionEmailCopy link Comments (0)


