When ever you print out your object directly, you will most likely always need to define the method yourself so that you get the output required for your program.
When you try and print out an...
Type: Posts; User: newbie
When ever you print out your object directly, you will most likely always need to define the method yourself so that you get the output required for your program.
When you try and print out an...
Whenever an attempt to print an object is made, it automatically calls its toString method, which will print in a format you do not want, with numbers and @ etc. So by overriding toString, it means...
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package plantnursery;
import java.util.Scanner;
/**
*
* @author Kl2eativ
No as fragile is a boolean variable.
I assumed you had more code that what you posted,
ie. you have " heightInFeet" in your code which isn't declared anywhere in what you posted.
Reason you get error would be because the inputs you provide aren't "true" or "false".
as you state nextBoolean(), the only correct inputs would be "true" or "false", where "yes","no","maybe" aren't...