Results 1 to 6 of 6
Thread: Check my JAVA theory HW?
- 10-28-2011, 12:36 AM #1
Member
- Join Date
- Oct 2011
- Posts
- 19
- Rep Power
- 0
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
- 10-28-2011, 12:42 AM #2
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.
- 10-28-2011, 12:48 AM #3
Member
- Join Date
- Oct 2011
- Posts
- 19
- Rep Power
- 0
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?
- 10-28-2011, 12:55 AM #4
Re: Check my JAVA theory HW?
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?
-
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.
- 10-28-2011, 01:04 AM #6
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
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.
Have you tried running this? What happens? Do these methods have the same parameter list?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.
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.
This seems strange since you had this above:i. Overloaded methods must return the same type of data.
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.a. myMethod(…) may be overloaded as:
int myMethod(int x, int y) and float myMethod(int x, double y).
true
Similar Threads
-
Working in theory, a inquisitive file output question.
By Dark in forum New To JavaReplies: 12Last Post: 07-20-2011, 10:04 PM -
OO Class Theory Question
By Dark in forum New To JavaReplies: 22Last Post: 04-20-2011, 02:16 PM -
Minimax game theory with mancala
By jigglywiggly in forum New To JavaReplies: 2Last Post: 01-01-2010, 12:04 PM -
how to check java
By funkygarzon in forum New To JavaReplies: 10Last Post: 03-08-2009, 08:39 AM -
[SOLVED] Need help in theory of Java in netbeans
By kirly in forum New To JavaReplies: 3Last Post: 11-11-2008, 05:47 AM


LinkBack URL
About LinkBacks


Bookmarks