Advertisement
Nicksed

Untitled

Jun 7th, 2023 (edited)
443
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. // What greet() from GreeterExample would print
  2.  
  3. public abstract class GreeterAbstract {
  4.     public abstract void printMessage();
  5.    
  6.     public void greet() {
  7.         System.out.println("Hello!");
  8.     }
  9. }
  10.  
  11. public interface GreeterInterface {
  12.     void printMessage();
  13.    
  14.     default void greet() {
  15.         System.out.println("Greetings!");
  16.     }
  17. }
  18.  
  19. public class GreeterExample extends GreeterAbstract implements GreeterInterface {
  20.     // Implementation goes here
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement