-2

Please look at attached pictures.

The main purpose of SelectCharacter.
- General 3 in-game "characters" and lets the user select one by 1,2 or 3
- return the selected character (Archer, Ninja, Warrior)
- This will then be instantiated in the Main class

Getting following error: Error:(32, 5) java: missing return statement

I've tried case statements and not too sure what the issue is now.
Any Advise is appreciated
if I've missed something please let me know and I can provide more if required :)

SelectCharacter Class

Main Class

Federico klez Culloca
  • 26,308
  • 17
  • 56
  • 95
MysticalGoat
  • 1
  • 1
  • 4

1 Answers1

0

You are not handling condition, when input != [1,2,3], say input =4.

Either make the last else-if in ChooseCharacter() as else only

OR

Add a return statement after your if - else if - else if ,returning a Person Object

Aditya Rewari
  • 2,343
  • 2
  • 23
  • 36