Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Theory questions about Java

  1. #1
    Junior Member
    Join Date
    Jul 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Theory questions about Java

    I've been reading my text book and I'm studying for an upcoming test and I have some questions. As you might notice my questions are pretty basic but that's because we're only beginning to cover this topic and therefore we won't have anything serious on inheritance on the test but it will be there mildly. Anyways, on to my questions (sorry if they're badly worded):

    -------------------------------

    1) If a class is not abstract but it has an abstract method, is it true that it still CAN NOT be instantiated? Or do abstract methods only exist inside abstract classes?

    2) The purpose of an abstract METHOD is to make sure the subclass overrides the method but what's the purpose of an abstract CLASS? Is the purpose of an abstract CLASS to be able to store the abstract METHODS? (that is IF I am right in saying that abstract methods HAVE TO BE in abstract classes)

    3) Imagine I had an array called, and set up as, array[rows][columns]. Doing array.length would give me the length of the rows but is array[].length the way to get the length of the columns?

    -------------------------------

    Any input would be greatly appreciated!
    Thanks in advance!

    Savvycom software
    Last edited by susan12; July 23rd, 2012 at 02:49 AM.


  2. #2
    Member
    Join Date
    Jul 2012
    Posts
    83
    My Mood
    Cynical
    Thanks
    3
    Thanked 9 Times in 9 Posts

    Default Re: Theory questions about Java

    Quote Originally Posted by susan12 View Post
    1) If a class is not abstract but it has an abstract method, is it true that it still CAN NOT be instantiated? Or do abstract methods only exist inside abstract classes?
    The animal doesn't exist. If it has abstract methods, it must be an abstract class or interface.

    2) The purpose of an abstract METHOD is to make sure the subclass overrides the method but what's the purpose of an abstract CLASS? Is the purpose of an abstract CLASS to be able to store the abstract METHODS? (that is IF I am right in saying that abstract methods HAVE TO BE in abstract classes)
    Having the class be abstract forces you to extend the class, to create a concrete subclass before using it.

    3) Imagine I had an array called, and set up as, array[rows][columns]. Doing array.length would give me the length of the rows but is array[].length the way to get the length of the columns?
    No, you have to give the row number, i.e., array[0], because you can have ragged arrays with different length of each row.

    -------------------------------

    Any input would be greatly appreciated!
    Thanks in advance![/QUOTE]

Similar Threads

  1. Help in java questions
    By Normal9ja in forum Java Theory & Questions
    Replies: 3
    Last Post: September 21st, 2011, 08:42 PM
  2. Some help with Java theory?
    By Mudkipers in forum Java Theory & Questions
    Replies: 7
    Last Post: May 12th, 2011, 07:28 AM
  3. Some Theory based questions
    By Bacon n' Logic in forum File I/O & Other I/O Streams
    Replies: 6
    Last Post: October 1st, 2010, 06:23 PM
  4. advanced java networking help/theory
    By wolfgar in forum Java Theory & Questions
    Replies: 2
    Last Post: February 7th, 2010, 07:02 PM
  5. theory about serial / parallel port & java
    By wolfgar in forum Java Theory & Questions
    Replies: 5
    Last Post: January 4th, 2010, 10:08 PM