Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialkelvino
Courses Plus Student 10,694 Pointsplease I need help on the interface in Java
Fill in the blank to create an Array that can contain both Wine and Cheese:
public class Main { public static void main(String[] args) { Wine wine = new Wine(); Cheese cheese = new Cheese(); --Object[ ]--- foods = {wine, cheese}; } }
class Wine implements Drinkable, Delicious { //omitted }
class Cheese extends Dairy implements Delicious { // omitted }
1 Answer
kelvino
Courses Plus Student 10,694 PointsFill in the blank to create an Array that can contain both Wine and Cheese:
public class Main { public static void main(String[] args) { Wine wine = new Wine(); Cheese cheese = new Cheese(); --Object[ ]--- foods = {wine, cheese}; } }
class Wine implements Drinkable, Delicious { //omitted }
class Cheese extends Dairy implements Delicious { // omitted }
Ayana Bando
9,964 PointsAyana Bando
9,964 PointsDid you ever receive an answer to this? I am getting it wrong as well