Carolina Carvajal

Greenhorn
+ Follow
since Nov 05, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Carolina Carvajal

Im really confused by the whole pass by value thing.
Take this example from my book:
public class ch4question6
{
public static void main (String [] args)
{
int max=0;
max(1,2,max);
System.out.println(max);
}
public static void max (int value1, int value2, int max)
{if (value1>value2)
max=value1;
else
max=value2;
}
}
I know it means that a copy of the value outside the method is being passed on. So does this mean that "max(1,2,max)" is being passed on to the parameter "(int value1,int value2,max)"
k...im starting to realize this is a dumb question. let me know if im right.
ALSO, why is "int max=0" there? Whats the point of that statement? The program cant run without it, thats for sure.
THANKS!
[ November 05, 2003: Message edited by: Carolina Carvajal ]
20 years ago