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 5 of 5

Thread: Simple question about methods.

  1. #1
    Junior Member
    Join Date
    Feb 2013
    Posts
    11
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Simple question about methods.

    Consider the following code:

    import java.io.*;
    class Daddy {
      int methodOne( int a, long b ) throws IOException { … }
      float methodTwo( char a, int b ) { … }
    }
    public class Boy extends Daddy { }

    And the methods:
    (α) public static void main( String args[] ) { … }
    (b) int methodOne( int c, long d) throws ArithmeticException { … }
    (c) float methodTwo( char c, int d) { … }

    Witch of them belong to Boy class?
    1. (α) & (β)
    2. (b) & (c)
    3. (α) & (c)
    4.All of them.


    Personaly i believe a) belongs 100% to boy class cause its the main but im not sure about the other two :/ What u think guys?
    Last edited by Norm; March 3rd, 2013 at 03:55 PM. Reason: changed quote to code tags


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Simple question about methods.

    Where is the main() method defined?

    Please edit your post and wrap your code with
    [code=java]
    <YOUR CODE HERE>
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Feb 2013
    Posts
    11
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Simple question about methods.

    the main is in boy class from what i understand this is the code the question it doesnt contain anything else :/

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Simple question about methods.

    I do not see the main() method. It's not in the posted code.
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Feb 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Simple question about methods.

    try to put "main()"method..

Similar Threads

  1. A Question About Merging Many Methods into One
    By chaucer345 in forum Java Theory & Questions
    Replies: 3
    Last Post: October 14th, 2012, 06:09 PM
  2. Question to do with methods.
    By Dragonkndr712 in forum Java Theory & Questions
    Replies: 3
    Last Post: March 31st, 2011, 11:56 PM
  3. [SOLVED] Help with Class Methods(Probably simple)
    By ShakeyJakey in forum Object Oriented Programming
    Replies: 9
    Last Post: May 27th, 2010, 09:53 AM
  4. A question about inherited methods
    By joachim89 in forum Object Oriented Programming
    Replies: 1
    Last Post: January 12th, 2010, 09:06 PM
  5. not so simple, simple swing question box
    By wolfgar in forum AWT / Java Swing
    Replies: 2
    Last Post: November 20th, 2009, 03:47 AM