code_junkie

Java: Interface vs Abstract Class (regarding fields)

Nov 13th, 2011
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. public interface Sendable {
  2. public void sendMe();
  3. }
  4.  
  5. public class AbstractSender implements Sendable {
  6. public abstract void send();
  7.  
  8. public void sendMe() {
  9. send(this.toString());
  10. }
  11. }
  12.  
  13. public abstract class A {
  14.  
  15. protected Object thing;
  16. }
  17.  
  18. A a = new A();
  19. a.thing.toString();
Add Comment
Please, Sign In to add comment