Created
August 2, 2020 14:53
-
-
Save LaurentiuGabriel/cbe2bb379a65d85777ac0ffa2211aeac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Objects; | |
| public class Laptop extends Computer { | |
| private String manufacturer; | |
| public String getManufacturer() { | |
| return manufacturer; | |
| } | |
| public void setManufacturer(String manufacturer) { | |
| this.manufacturer = manufacturer; | |
| } | |
| @Override | |
| public void start() { | |
| System.out.println("Laptop started"); | |
| } | |
| @Override | |
| public void showInfo() { | |
| System.out.println("Laptop showInfo() method called"); | |
| } | |
| public < E > void genericMethod(E[] inputArray){ | |
| for (E element : inputArray){ | |
| System.out.println("Here is the element: " + element); | |
| } | |
| } | |
| @Override | |
| public boolean equals(Object o) { | |
| if (this == o) return true; | |
| if (o == null || getClass() != o.getClass()) return false; | |
| Laptop laptop = (Laptop) o; | |
| return Objects.equals(manufacturer, laptop.manufacturer); | |
| } | |
| @Override | |
| public int hashCode() { | |
| return Objects.hash(manufacturer); | |
| } | |
| @Override | |
| public String toString() { | |
| return "manufacturer=" + manufacturer; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment