Question: Java language. Thanks in advance a Given below is a class Bottle that has attributes material and size. Your task is to rewrite the code

 Java language. Thanks in advance a Given below is a class

Java language. Thanks in advance

a Given below is a class Bottle that has attributes material and size. Your task is to rewrite the code so that it implements the Comparable interface. The ordering is based on material only. public class Bottle implements Comparable { private String material; private int size; public Bottle(String m, int s) { material = m; size=s public String materialo { return material; } public int size({ return size; > public void set Material(String m) { material=m; 2 public void setSize(int s) { size=s; ) public String toString({ return material +"- '+ size; What is an enumerated type (enum)? Give an example of one. (4 marks)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!