Tuesday, 3 September 2013

Creating a method that returns a string

Creating a method that returns a string

So far my code looks like this:
public class Tree {
public static void main (String[] argv) {
int serial; //create parameters
double circumference;
String species;
}
public Tree(int serial, double circumference, String species){
String.format("Tree number %d has a circumference of %.2f and is of
species %s.", serial, circumference, species);
}
}
I'm not sure how I go about making a describe() method that returns a
String with the tree information in a very specific format...
Thanks!

No comments:

Post a Comment