public class Test {
public static void main(String[] args) {
int max = 0;
max(1, 2, max);
System.out.println(max);
}
public ststic void max(
int value1, int value2, int max) {
if (value1 > value2)
max = value1;
else
max = value2;
}
}
richies
0
Newbie Poster
Recommended Answers
Jump to PostIs this for homework?
What's your theory as to why this code will not work (apart from spelling errots!)
Jump to Postyour function is incorrect buddy...why do u need a third variable being passed to the function max?
Jump to Postyour function is incorrect buddy...why do u need a third variable being passed to the function max?
because if he wouldn't,it would not work.
the method does require three integers to be passed, so he'll need to pass a third one.
I agree that it's useless, since it's not really …
All 12 Replies
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
eman 22
0
Junior Poster in Training
vaibhav1983
1
Junior Poster
stultuske
1,116
Posting Maven
Featured Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
stultuske
1,116
Posting Maven
Featured Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
stultuske
1,116
Posting Maven
Featured Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
vaibhav1983
1
Junior Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
stultuske
1,116
Posting Maven
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.