you should notice that many objects methods
does not alter the state of the object...
for example look at this example with the BigDecimal
BigDecimal num1 = new BigDecimal( 1.0 );
System.out.println( num1 ); // the output is 1.0
num1.add( new BigDecimal( 1.0 ) );
System.out.println( num1 ); //...
Besides
The beginblock and ending block of if and loop statement are in a wrong place...
The right place is
while( boolean_expression ) {
// statements excecuted when the condition is true
}
if( boolean_expression ) {
// statements excecuted when the condition is true
}
if(...
Ok...:-)
I think that the solution to your problem is undertanding
that for String comparation you must use the equals
or equalsIgoneCase methods defined in the class String...
Your loop condition actually compares references to object
not the content of the String object,
you'd rather...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.