When you pass by value, you "create" a second instance of the variable, local only to the function receiving it...
When you pass by pointer/reference you can see it as passing a big neon arrow pointing to the original variable...
thus you can imagine, as no additional memory is allocated or the value is not duplicated, it is much more efficient to pass a pointer/reference rather than by value, however this would mean that the function called would be able to change the value of the variable and have that change reflected back to the original...
To avoid this you could create a new variable in the function containing the value of the pointer passed, but then you are doing exactly the same as passing by value
"const int* MyInt"
would pass a pointer and make it constant (not changable)
Well, consider this: When you pass a pointer to a function, that pointer is being passed by value. So which is faster, passing a pointer by value or passing a value by value? I don't see how a pointer can be faster. If I am figuring this right, when the source code is translated into machine code, the machine code for dealing with a pointer would be a tad bit larger and take a little bit longer to address the data than directly addressing the data. But that may depend on the processor.
Pointers are passed by value. What this means is that for POD types passing a value to a function by pointer instead of by value makes very little difference. Imagine a 32 bit machine with 32 bit ints and 32 bit pointers. You have an integer to pass so in either case you are poutting 32 bits onto the stack.
You only really need to use pointers to pass POD types if the function you are calling is going to alter that parameter and the calling code wants to receive the new value set by the function.
However once you introduce classes then passing by pointer can have a very large effect. You may not know the implementation of a particular class but passing it by value means that the entire class needs to be copied. In this instance passing the class to the function by pointer can save a lot of processing and memory allocation/deallocation.
If you are going to pass by pointer then remember it is better where possible to actually pass by reference (since the calling code does not then need to check that the pointer is valid) and where possible, where the function does not actually change the data pointed to/referenced you should make the pointer or reference const.
Ah! Serious beginner C++ programmer errors. Reference variables are much like pointers, but you can declare them as const, and thus refuse the called funtion from modifying them without going through some contortions (such as explicitly casting them as non-const). The issue is your intention. If you WANT the called function to be able to modify the contents of the object, then pass them as non-const, otherwise, a const reference is preferable. For C++, passing variables as pointers is usually not recommended. Example (from your source):
void class::b(int& MyIntRef)
int MyInt = 5;
//MyInt now == 6
public class GrossmontBank
//class variables (global - accessible throughout this class)
//scanner object to be used throughout
private static Scanner input = new Scanner(System.in);