// oDet is a reference to an OrderDetail object (emphasis on IS A REFERENCE TO)
OrderDetail tempDet = oDet;
// Now tempDet is a reference to the same OrderDetail object
System.out.println(oDet.symbol + " before " + oDet.orderRefNum);
tempDet.symbol = MarketPrices.marketPrices.get(c).symbol;
// Via the tempDet reference, we just changed the value of the OrderDetail field 'symbol'
System.out.println(oDet.symbol + " after " + oDet.orderRefNum);
// Therefore we just printed the new value, because the same OrderDetail object happened to be REFERED TO by two different variables

Ah the old reference VS instance confusion. If you make that (understandable) mistake you should be posting in New to Java.

Think of it like this:

Book - its a class

Harry Potter - its an instance of Book (Book book = new Book("harry potter"))

A note in your phone mentioning that the harry potter book is at your parents - its a reference to the Book instance
A note in your email mentioning that the harry potter book is at your parents - its another reference to the same Book instance!

A bit of imagination needed to compare a real world note to a variable in programming terms ;)

In your case initially d is 5 as set in the main method.
Then you are assigning d to b. Now b and d have value 5.
Then you are creating a new String c with value 7. Now b and d have 5 and c has 7.
Then you are assigning c to b. Now b and c have 7 and d has 5.

In the whole operation you have not modified d hence d remains with whatever you have passed to the test method. Hence d stays 5.