Shared Instructions Indicate the result of the snippet of co…

Shared Instructions Indicate the result of the snippet of code, assuming that it is in a main method of a class. More specifically, you must indicate one of the following: the output of the code, if the code compiles and runs without errors which statement(s) don’t compile (line #s, first line is #1) and why, if the code doesn’t compile when put in a main method the type of runtime error (a class name ending with Exception) and the statement that caused it (line #, first line is #1) if the code compiles but doesn’t run properly Shared Code public class Vehicle { // In Vehicle.java public String toString() { return “vehicle”; } public String fuel() { return “gas”; }}public class Truck extends Vehicle { // In Truck.java public String toString() { return “truck”; }}public class Car extends Vehicle { // In Car.java public String toString() { return “car”; } public String honk() { return “beep”; }}public class Sedan extends Car { // In Sedan.java public String toString() { return “sedan”; }} Unique Snippet Vehicle v = new Car();Truck t = (Truck) v;System.out.print(t.toString());

Write a compareTo method for a Product class that uses two i…

Write a compareTo method for a Product class that uses two instance variables to determine order: price (double) and name (String). The ordering of Student established by this class is:  Order first by price, in ascending order (lowest price first). If prices are equal, order by name alphabetically (A before Z). If both variables are the same between the instances, the products are equal. You do not have to add the code for the instance variables.   Canvas Tip for all Qs: Click on the dropdown that says “Paragraph” and switch to “Preformatted” to get a monospaced font – this can help in coding answers