なかなかコンパイルが通らなくてずっと悩んでさっきも試したのに
うまくいかなくて・・・でもthrows IOExceptionつけたらうまくいって・・・・
さっきも試したのに・・・?何故??結局根本的な原因がわからないまま解決してしまった。

import java.io.*;
public class ButtonControl
{
       void button() throws IOException{
InputStreamReader is = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(is);
System.out.println("エレベータへようこそ!行きたいフロアのボタンを押してください。");
String charfloor = br.readLine();
int floor =Integer.parseInt(charfloor);
System.out.println("あなたは" + floor + "階に行くボタンを押しました");
}


public static void main(String[] args) throws IOException{
ButtonControl buttonControl = new ButtonControl();
buttonControl.button();

}}