string as boolean in array
843810Apr 10 2004 — edited Apr 14 2004Hey, im new to all this,
in the class name i have made a
boolean [ ] thing and in the contructor i have said, thing = new boolean[5];
ln a particular method called getProperty i have prompted the user with a question, if they type "y" i want 'true' to be stored in the array and if "n" then 'false' otherwise an error message is printed
I have tried for ages to get this to work using a String named temp
i have gone
public void getProperty()
String temp;
for(int i = 0, i<5, i++)
temp = keyboard.readString("question?")
if temp = 'y'
{
thing[ i ] = true;
but i get
incompatible types
found: java.lang.string
required: boolean