public Note( Scanner input )
{
freq = input.nextInt();
}
Приведенный выше код находится в отдельном файле со всем необходимым для запуска.
public void keyTyped( KeyEvent e )
{
char key = e.getKeyChar();
if( 'a' <= key && key <= 'y' )
{
// Ex5: put code here to add a new note to the list of notes
// in position current and increment current.
// Tip: key - 'a' will be an integer between 0 and 24,
// inclusive, corresponding to the desired note number when
// the user presses 'a' through 'x'
// Scanner input = new Scanner( System.in );
---->// song.add( current, new Note( ? ));
// current++;
System.out.println(key - 'a');
}
Мне нужно найти способ передать int в конструктор, который требует Scanner. Обратите внимание, что это будет не весь код, а просто код, который, как я думал, потребуется.