📜  资源泄漏java代码示例

📅  最后修改于: 2022-03-11 14:52:48.644000             🧑  作者: Mango

代码示例1
public void readShapeData() throws IOException {
    Scanner in = new Scanner(System.in);
    try {
        System.out.println("Enter the width of the Rectangle: ");
        width = in.nextDouble();
        System.out.println("Enter the height of the Rectangle: ");
        height = in.nextDouble();
    } finally {
        in.close();
    }
}