Results 1 to 3 of 3
  1. #1
    grainulara is offline Member
    Join Date
    Aug 2015
    Posts
    1
    Rep Power
    0

    Default How to understand interaction of Java Classes

    If you instantiate a Cat class which extends from Animal and Animal and Cat both have instance and static methods. On Cat instance you can call Animal's methods as well as Cat's methods. How do you keep track of all that trail in your head? I understand you can look at the documentation but is therea simple method of memorising the trail that OO developer's use?

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    14

    Default Re: How to understand interaction of Java Classes

    Yes. You may call either protected or public methods that are declared in the super class (in your case Animal). Just by using the classes over again do you get a sense of what methods are available. I have been doing this for quite a while and still rely on the documentation for those classes I don't use very often.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  3. #3
    Join Date
    Aug 2015
    Location
    Northern California
    Posts
    31
    Rep Power
    0

    Default Re: How to understand interaction of Java Classes

    This is one of the most important topics in OOP, not just Java so there's framework in place for just this purpose. Animal is the superclass you won't call Animal directly but rather derive a Cat from an Animal object. You create contracts how to implement Animal class by using abstract methods within the Animal class so now the Cat class must override them in order to be an Animal. A lot of the things you learn in programming protect us from the human factor or aid us in finding our human borne errors.

Similar Threads

  1. Java and Command line interaction
    By mademoiselle in forum New To Java
    Replies: 1
    Last Post: 08-07-2014, 03:02 PM
  2. Abstract Classes... Do I understand this?
    By Jingoism in forum New To Java
    Replies: 2
    Last Post: 11-16-2012, 09:35 PM
  3. Help with Java interaction with flash games?
    By Yoni201 in forum New To Java
    Replies: 3
    Last Post: 01-30-2012, 01:28 AM
  4. GUI problem, interaction in Java!!!
    By lulzim in forum New To Java
    Replies: 1
    Last Post: 05-20-2011, 10:34 PM
  5. Java interaction
    By satimis in forum New To Java
    Replies: 4
    Last Post: 06-30-2010, 05:14 PM

Tags for this Thread

Posting Permissions

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