Where exactly does the input code go?

Hey guys, so I’m using basic key polling for the most part, and I just pass the key listener as an argument to whatever game state or game object needs it. So something like

Player player = new Player(x, y, keyboard);

And then in player.update() it would be something like


keyboard.update();
if(keyboard.up) player.moveUp();
if(keyboard.down)player.moveDown();
...

So just wondering if this is the right way to do it, because people tell me I should separate input logic from game logic/ update loop, but I’m not really sure where it goes.