daily pastebin goal
84%
SHARE
TWEET

Untitled

a guest Feb 20th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. interface A {
  2.    void someMethod();
  3. }
  4.  
  5. class B implements A {
  6.     void someMethod() {
  7.         // implementation here
  8.     }
  9. }
  10.    
  11. class c implements A { //this  should not allowed in this project
  12. }
  13.    
  14. // Hides the implementation details of ArrayList within a List variable
  15. List<String> strs = new ArrayList<String>();
  16. // Hides the implementation details of LinkedList within the same List variable
  17. strs = new LinkedList<String>();
  18. // All code using strs is agnostic to what kind of list it is (mostly)
  19. strs.add("Hello, Dolly");
  20. System.out.println(strs.get(0));
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top