Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me;
- /**
- * This class represents an Orange, you know... the orange fruit...
- * u/Smiley-_-Face... you know what an orange is right?
- */
- public class Orange extends Fruit {
- private int number;
- /**
- * This creates an Orange... it can be eaten, thrown out, or squeezed.
- * @param number the unique number given to this {@link Orange}.
- */
- public Orange(int number) {
- this.number = number;
- }
- /**
- * This creates an Orange with no data to demonstrate forEach function.
- */
- public Orange() {
- }
- /**
- * This squeezes the orange.
- */
- void squeeze() {
- System.out.println("Successfully squeezing out Orange #" + this.number);
- }
- /**
- * This function eats the {@link Orange}
- * @return inherit
- */
- @Override
- boolean eat() {
- System.out.println("Successfully eating out Orange #" + this.number);
- return true;
- }
- /**
- * This function throws out the {@link Orange}
- * @return inherit
- */
- @Override
- boolean throwOut() {
- System.out.println("Successfully throwing out Orange #" + this.number);
- return true;
- }
- /**
- * This gets the unique number given to this {@link Orange}.
- */
- public int getNumber() {
- return this.number;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement