slotgasil.blogg.se

Missing return statement bluej
Missing return statement bluej







If the int value passed is below 72, the method returns false, and if the value passed is above 72, the method returns true. The above statement will give Error: not a statement along with Error: ‘)’ expected compilation errors because of the incorrectly added extra semicolon( ) after value of in the above statement. Simple If statement not working (BlueJ) Ask Question Asked 7 years, 4 months ago.

MISSING RETURN STATEMENT BLUEJ CODE

7, 2), the code should return 4 but instead returns 2. This method’s return statement is of boolean type based on whether the parameter is above or below 72. Syntax error: The program would not compile because the main method would be calling a method. As it stands, there are posted answers that correct the problem posed in the question.

missing return statement bluej missing return statement bluej

In programming, we use the if.else statement to run a block of code among more than one alternatives.įor example, assigning grades (A, B, C) based on the percentage obtained by a student. The first method declares the return value as boolean and the acceptable parameter as int. If you want any more help, you'll pretty much need to strip the code down to JUST the toString method, write it in a way that the compiler won't complain about a missing return, and then we'll help you work through any remaining problems.







Missing return statement bluej