1. Engineering
  2. Computer Science
  3. what does this program print if we run the main...

Question: what does this program print if we run the main...

Question details

What does this program print if we run the main method? * . class Coord public int row, col; public Coord (int row, int col) t this.row row; this.col co class Car f public String color; public Coord location; public Car (String color, Coord location) f this.color color; this.location Location; public class Q1f public void g(Car c1, Car c2) f c2 - c1; c2.color - blue; public String question f Car redCar new Car (red, new Coord (5, 6)) Car greenCar new Car(green, new Coord (7, 8)); this.g(redCar, greenCar); return redCar.color + , + greenCar.color; public static void main(StringIl args) f System.out.printin(new Q10.question O)
What does this program print when the main method is run?* class Item f String name; int price; public Item(String name, int price)f this.name name; this price price; public boolean equals (Object other) ( if (! (other instanceof Item)) f return false, Item i (Item)other; return this.name.equals (i.name) && this.price i.price; public class QQ f public static void main(Stringl] args) f Item item1 new Item(Umbrella, 12) Item item2 new Item(chair, 30) j Item item3 new Item(Umbrella, 12) System.out.println (itemi item2) +,+ itemi.equals(item2) + ,+ (itemi item3) +, + itemi.equals(item3) +, + (item2 item3) +, + item2.equals(item3))
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution