Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Couple Of Programming Questions
#4
Conciente Wrote:Hello,

I have a couple of questions: (Java related)

1. What is an interface? What is an abstract class? What are their differences and when is it better to use one or the other?

2. What is the Static attribute? Define it when it is used on a Method. When is it convenient to use the Static attribute?

To add to what the others have said, use an abstract class when you want to provide implementation of some methods, use an interface when you don't.

Define a method as static when it doesn't make sense for it be associated with an object, ie it doesn't use any of the object's state. If you have a lot of static methods, it's a sign you may be thinking too procedurally.
Reply


Messages In This Thread
Couple Of Programming Questions - by Conciente - 2009-04-21, 11:49 PM
Couple Of Programming Questions - by Thunda - 2009-04-22, 01:18 AM
Couple Of Programming Questions - by Morgana - 2009-04-22, 02:42 AM
Couple Of Programming Questions - by Spaz - 2009-04-22, 03:09 AM
Couple Of Programming Questions - by Nikkey - 2009-04-22, 06:53 AM
Couple Of Programming Questions - by GummyBear - 2009-04-22, 10:39 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)