reset password
Author Message
disrael
Posts: 44
Posted 11:49 Oct 13, 2013 |

Not sure what to do here. Question states, "Provide a class for authoring a simple letter. In  the constructor, supply the names of the sender and the recipient:"

public Letter (String from, String to)

"Supply a method"

I'm not sure what method goes here. I keep re-watching the Ch 3 Udacity person examples but it still isn't clicking.

Any suggestions or hints would be greatly appreciated.

Eric Liao
Posts: 158
Posted 21:31 Oct 13, 2013 |

Method is like an function(action) you would define for the class.

So the line after "Supply a method" is that

public void addLine(String line)

means you are defining what is inside of this method.

 

Some skeleton like the following

 

public class Letter {
    // instance variables inside of letter
    String from;
    String to;

    // ... what else would be the variables here ???

    public Letter (String from, String to) {

    }

    public addLine(String line) {
        // the method you would define
    }
}