Results 1 to 6 of 6
  1. #1
    tripline is offline Member
    Join Date
    Oct 2011
    Posts
    19
    Rep Power
    0

    Default Check my JAVA theory HW?

    If I did something wrong, explain it to me as you would to a 13 year old kid, thanks!

    1. True or False. If false, give a short explanation.

    a. myMethod() may be overloaded as:
    int myMethod(int x, int y) and float myMethod(int x, double y).
    true

    b. yourMethod() may be overloaded as:
    int yourMethod(int x, int y) and int yourMethod(int x, double y).
    true

    c. hisMethod() may be overloaded as:
    int hisMethod(int x, int y) and float hisMethod(int x, int y).
    false, need to have different parameters

    d. herMethod() may be overloaded as:
    int herMethod(int x, int y) and int herMethod(int x, int y, int z).
    false the extra int z does not make it over load, need different paramenters.

    e. Every Java application begins execution with main().
    True

    f. main() can invoke at most three other methods.
    False, there is no limit on the number you can call.

    g. A method can call a method that in turn calls another method.
    True

    h. Overloaded methods must have a different number of parameters.
    False, their data types of their parameter list can differ.

    i. Overloaded methods must return the same type of data.
    True


    j. The parameters in the header of a method are called the actual parameters.
    False, the values passed to a method are called actual parameters.


    k. Arguments can be expressions or constants.
    True

    l. The type of each parameter must match the type of its corresponding argument.
    True


    m. The scope of a parameter in a method extends to the end of the method.
    True


    n. The scope of a local variable extends to the end of the method in which it is defined.
    True

    o. Every method returns a value.
    False, Java's main methods do not return a value directly

    p. The name of a method cannot begin with an uppercase letter.
    True

    q. Methods provide a programmer with a mechanism to segment a complicated application into simpler and easier-to-debug components.
    True

    r. A method can use the same name for a local variable and a formal parameter.
    True

  2. #2
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,800
    Rep Power
    7

    Default Re: Check my JAVA theory HW?

    Here's an idea. How about you hand in your homework, have your teacher mark it and when you get it back you will know if it was right or not.

  3. #3
    tripline is offline Member
    Join Date
    Oct 2011
    Posts
    19
    Rep Power
    0

    Default Re: Check my JAVA theory HW?

    I rather have one of the 680 people online who love this stuff do a skim over and learn that way. Hurts nobody right?

  4. #4
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,800
    Rep Power
    7

    Default Re: Check my JAVA theory HW?

    Quote Originally Posted by tripline View Post
    Hurts nobody right?
    Yes it does.

    Lets say you got all questions wrong. I then provide you with all the correct answers. Your grade just went from 0% to 100% and you get a mark that you did not earn. Homework is supposed to test your knowledge not mine. So who does it hurt? It hurts the other students in the class who got a grade based on their own work and understanding. Why should you get a better grade than them because I (or someone else) provided you with the answers?

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Check my JAVA theory HW?

    I agree with Junky, this really isn't a "check my homework" site. If you have a specific question about code, then please ask it. I'm going to lock this thread now, but may re-open it if the other moderators disagree with these actions.

  6. #6
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default Re: Check my JAVA theory HW?

    My three cents: (that's right, three not two)
    While normally it seems weird to ask for us to check homework, he seems to have made the effort and done the assignment before coming here. I see nothing wrong with seeking out help from others to verify the correctness of his work.


    d. herMethod(…) may be overloaded as:
    int herMethod(int x, int y) and int herMethod(int x, int y, int z).
    false the extra int z does not make it over load, need different paramenters.
    Have you tried running this? What happens? Do these methods have the same parameter list?

    Also, in regards to some others, are you supposed to answer whether it will compile, or whether it fits java conventions? A method can start with an uppercase letter, it's just doesn't follow java conventions.

    i. Overloaded methods must return the same type of data.
    True
    This seems strange since you had this above:
    a. myMethod(…) may be overloaded as:
    int myMethod(int x, int y) and float myMethod(int x, double y).
    true
    These two methods return a different type. Other than that I don't see anything that calls attention to me. Please feel free to contest anything you may disagree with.

Similar Threads

  1. Replies: 12
    Last Post: 07-20-2011, 11:04 PM
  2. OO Class Theory Question
    By Dark in forum New To Java
    Replies: 22
    Last Post: 04-20-2011, 03:16 PM
  3. Minimax game theory with mancala
    By jigglywiggly in forum New To Java
    Replies: 2
    Last Post: 01-01-2010, 01:04 PM
  4. how to check java
    By funkygarzon in forum New To Java
    Replies: 10
    Last Post: 03-08-2009, 09:39 AM
  5. [SOLVED] Need help in theory of Java in netbeans
    By kirly in forum New To Java
    Replies: 3
    Last Post: 11-11-2008, 06:47 AM

Posting Permissions

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