• (2 Pages)
  • +
  • 1
  • 2

Abstract Classes vs. Interfaces all about Abstract Classes, Abstract methods and Interfaces Rate Topic: -----

#16 bvarghese2155  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 13-August 12

Posted 12 September 2012 - 06:42 AM

View PostfromTheSprawl, on 11 September 2012 - 11:06 PM, said:

Hey there. Once you extend an abstract class you need to write the implementation for those abstract methods which have no implementation on the abstract class. Those that have an implementation on the abstract class can be left as is. You can override them too, if you like.

ArrayLists can change size according to your need. They grow bigger and bigger and you can put in stuff at an ArrayList without thinking about declaring a new array with a new size just to add another element.

By the way by storing Strings and longs do you mean different objects in one collection? Yes, it is possible but you must find something that binds them together, like a similar Interface or class, in this case, the Object class. It would be tricky to print them though in one go.

Others, any thoughts?


I see, so if I extend an abstract class, I only have to implement the method if hasn't been done so already, and if I implement an interface, I have to implement all methods in that interface because interfaces can only declare methods.
Was This Post Helpful? 0
  • +
  • -

#17 fromTheSprawl  Icon User is offline

  • Monomania
  • member icon

Reputation: 513
  • View blog
  • Posts: 2,056
  • Joined: 28-December 10

Posted 12 September 2012 - 07:12 PM

According to Oracle, Interfaces can contain only constants, method signatures, and nested types, so you can also declare variables and nested types.
Was This Post Helpful? 0
  • +
  • -

#18 novellof  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 15
  • Joined: 24-May 14

Posted 27 May 2014 - 02:14 AM

Thank you this made so much sense after reading your tutorial.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2