JAVA--实现类似C#输入功能的Console类

/* (程序头部注释开始)
 * 程序的版权和版本声明部分
 * Copyright (c) 2011, 烟台大学计算机学院学生 
* All rights reserved.
 * 文件名称:实现类似C#输入功能的Console类
* 作 者: 雷恒鑫 
* 完成日期: 2012 年 09 月 20 日
 * 版 本 号: V1.0 
* 对任务及求解方法的描述部分
 * 输入描述:
 * 问题描述:
 * 程序输出:
 
* 程序头部的注释结束
 
*/




import java.util.Scanner;

public class Console
{

    public static String readLine(){
        Scanner sc=new Scanner(System.in);
        return sc.next();
    }
    public static char readLine_char(){
        Scanner sc=new Scanner(System.in);
        String str=sc.next();
        return str.charAt(0);
    }
    public static int readInt(){
        Scanner sc=new Scanner(System.in);
        String str=sc.next();
        return Integer.parseInt(str);
    }
    
    public static double readDouble(){
        Scanner sc=new Scanner(System.in);
        String str=sc.next();
        return Double.parseDouble(str);
    }
}

你可能感兴趣的:(c,String,C#,Class,任务)