
-----------------------------------
Kenster102.5
Thu Nov 19, 2009 3:48 am

[URGENT Test] Desperately Confused, Instance Methods Invocation?
-----------------------------------
I used to be really good a Instance methods, now I am starting to really get confused. I have a re-test tomorrow on the writing a code for an instance method. 
I am really confused with explicit and implicit, and how implicit uses the reserved word "this.num" or "this.den". If someone can answer this dilemma before lets say 8:15 then I will be okay. 

Okay here is the question

Complete the definition of the following instance method for the Fraction class



public Fraction plus (Fraction f)


The method should return a Fraction object whose value is the sum of the implicit object parameter and the explicit parameter, f. The method should leave both its implicit and explicit parameters unchanged.


import java.awt.*;

public class FractionTest
{
  public static void main (String


I really really feel incompetent if I can't understand how a method using "this." can be invoked, I am really trying hard to understand. So please someone help me.
Thank you
Ken

-----------------------------------
DtY
Thu Nov 19, 2009 8:15 am

RE:[URGENT Test] Desperately Confused, Instance Methods Invocation?
-----------------------------------
'this' is a reference to itself, so if you do someInstance.plus(), when the function runs 'this' (inside the function) will be a reference to someInstance.

Btw, your fraction addition is wrong
