Hi friends, I have an error which says I used invalid cast from int to boolean! but the other side strWork is string and I do not understand what it says? Could you please help me on this? Many thanks, Elahe Error: ========= Invalid cast from int to boolean. if( strWork.compareTo( "0" ) ) { ^ Invalid cast from int to boolean. else if( strWork.compareTo( "1" ) ) { ^ 2 errors
The compareTo() method of the String class returns an int. An "if" test requires a boolean. Why not use the equals() method instead. It returns a boolean and should solve your problem.
JavaBeginnersFaq "Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt