Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Blender {
- public void blend() {
- System.out.println("There's nothing to blend here, boss.");
- }
- public void blend(String fruit1, String fruit2) {
- System.out.println("Blending " + fruit1 + " and " + fruit2 + ", boss.");
- }
- public void blend(String fruit1, String fruit2, int n) {
- for (int i = 0; i < n; i++) {
- System.out.println("Blending " + fruit1 + " and " + fruit2 + ", boss.");
- }
- }
- public static void main(String[] args) {
- Blender blender = new Blender();
- System.out.println("Action: Invoking blend(\"Pineapple\", \"Grapes\", 3) method of the Blender class.");
- System.out.println("Output:");
- blender.blend("Pineapple", "Grapes", 3);
- System.out.println();
- System.out.println("Action: Invoking blend() method of the Blender class.");
- System.out.println("Output:");
- blender.blend();
- System.out.println();
- System.out.println("Action: Invoking blend(\"Apple\", \"Banana\") method of the Blender class.");
- System.out.println("Output:");
- blender.blend("Apple", "Banana");
- System.out.println();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment