Delta_Sierra

Blender

Sep 11th, 2025
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.18 KB | None | 0 0
  1. public class Blender {
  2.     public void blend() {
  3.         System.out.println("There's nothing to blend here, boss.");
  4.     }
  5.     public void blend(String fruit1, String fruit2) {
  6.         System.out.println("Blending " + fruit1 + " and " + fruit2 + ", boss.");
  7.     }
  8.     public void blend(String fruit1, String fruit2, int n) {
  9.         for (int i = 0; i < n; i++) {
  10.             System.out.println("Blending " + fruit1 + " and " + fruit2 + ", boss.");
  11.         }
  12.     }
  13.     public static void main(String[] args) {
  14.         Blender blender = new Blender();
  15.         System.out.println("Action: Invoking blend(\"Pineapple\", \"Grapes\", 3) method of the Blender class.");
  16.         System.out.println("Output:");
  17.         blender.blend("Pineapple", "Grapes", 3);
  18.         System.out.println();
  19.         System.out.println("Action: Invoking blend() method of the Blender class.");
  20.         System.out.println("Output:");
  21.         blender.blend();
  22.         System.out.println();
  23.         System.out.println("Action: Invoking blend(\"Apple\", \"Banana\") method of the Blender class.");
  24.         System.out.println("Output:");
  25.         blender.blend("Apple", "Banana");
  26.         System.out.println();
  27.     }
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment