Results 1 to 3 of 3

Thread: Java terms

  1. #1
    Shaolin is offline Member
    Join Date
    Nov 2007
    Rep Power

    Default Java terms

    Hi Guys,

    I need some help defining some java terms. I've been reading up on them but I still cant get my head around some of them and would like someone to explain it in real simple terms with some examples please.

    1. Object
    2. reference (e.g. references to objects)
    3. instance
    4. What is the purpose of an abstract class?
    5. container
    6. packages test;
    7. import test.*;
    8. Polymorphism

  2. #2
    CaptainMorgan's Avatar
    CaptainMorgan is offline Moderator
    Join Date
    Dec 2007
    NewEngland, US
    Rep Power


    What exactly are you confused or unclear about? Your list contains some of the fundamentals of OOP and Java language basics. While reading up on them is good, you've haven't shown an attempt at discussing or displaying your understanding of these terms. Make an attempt to discuss your list items by focusing on the first one and if you have specific questions pertaining to the concept you're discussing or an example you're willing to show, then I'm sure you'll be answered.

  3. #3
    gibsonrocker800's Avatar
    gibsonrocker800 is offline Senior Member
    Join Date
    Nov 2007
    New York
    Rep Power


    While i agree with CaptainMorgan that you should attempt these things on your own, i want to explain the purpose of abstract classes because it was a hard concept for me to grasp at first.

    The purpose of an abstract class is to force one to extend that class if they want to construct an object of that type. For example, say i had a class:

    public abstract class BankAccount {}

    If i wanted to have a BankAccount in another program, i could not simply say:
    BankAccount account = new BankAccount();

    Due to the fact that this class is abstract, if i want to use it, i must make a class that extends it. So for example:
    public class SavingsAccount extends BankAccount {}

    Now, i can say BankAccount account = new SavingsAccount(); (i'm pretty sure, not completely positive on the BankAccount portion of the line).

    So, the purpose of doing this, is to make a class with general information that cannot stand alone, it must be further specified, but it has the basic info. An example that i just thought of, that would work well as an abstract class is a Weapon class for a video game. It defines general things like ammo and stuff like that, but in my main game class, i cannot define a general Weapon, i must make a more specific class that extends Weapon.

    So yeah, the rest are pretty easy to understand, and if you can't understand Objects and references, i wouldn't be worrying about abstract classes and polymorphism yet, first grasp the basic concepts, and then move on to more advanced topics.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts