system.setin

系统类setIn()方法 (System class setIn() method)

  • setIn() method is available in java.lang package.

    setIn()方法在java.lang包中可用。

  • setIn() method is used to assign again the standard input stream.

    setIn()方法用于再次分配标准输入流。

  • setIn() method is redirected because it does not read the input from the editor.

    setIn()方法被重定向,因为它不从编辑器读取输入。

  • setIn() method read the input from the standard input stream.

    setIn()方法从标准输入流中读取输入。

  • setIn() method is a static method, it is accessible with the class name too.

    setIn()方法是静态方法,也可以使用类名进行访问。

  • setIn() method may throw an exception while reading the input from the standard input stream:

    从标准输入流中读取输入时, setIn()方法可能会引发异常:

    SecurityException: In this exception checkPermission() method does not allow reassigning of the latest standard input stream when security manager exists.

    SecurityException:在此异常中,当存在安全管理器时,checkPermission()方法不允许重新分配最新的标准输入流。

Syntax:

句法:

    public static void setIn(InputStream set_in);

Parameter(s):

参数:

  • InputStream set_in – represents the latest standard input stream.

    InputStream set_in –表示最新的标准输入流。

Return value:

返回值:

The return type of this method is void, it does not return anything.

此方法的返回类型为void ,它不返回任何内容。

Example:

例:

// Java program to demonstrate the example of
// setIn () method of System Class
import java.lang.*;
import java.io.*;
public class SetInMethod {public static void main(String[] args) throws Exception {// Display file in a specific manner
System.setIn(new FileInputStream("E://Programs//getProperties().doc"));
// Read the first character in the file
char read_first_char = (char) System.in.read();
// Display first character of the File
System.out.println(read_first_char);
}
}

Output

输出量

E:\Programs>javac SetInMethod.java
E:\Programs>java SetInMethod
J

翻译自: https://www.includehelp.com/java/system-class-setin-method-with-example.aspx

system.setin

system.setin_Java System类setIn()方法及示例相关推荐

  1. getenv java_Java System类getenv()方法及示例

    系统类getenv()方法getenv()方法在java.lang包中可用. getenv()方法用于返回键值对中当前环境变量的不可修改Map. 我们将看到什么是环境变量?环境变量是系统相关的外部命名 ...

  2. java super.getclass_Java Class 类 getSuperClass()方法及示例

    Class类getSuperClass()方法getSuperClass()方法在java.lang包中可用. getSuperClass()方法用于返回Class,该Class表示此Class表示的 ...

  3. java long short_Java Long类shortValue()方法与示例

    Long类shortValue()方法shortValue()方法在java.lang包中可用. shortValue()方法用于返回由此Long对象表示的值,该对象转换为short类型(通过强制转换 ...

  4. java annotation class,Java Class类 isAnnotation()方法及示例

    Class类isAnnotation()方法isAnnotation()方法在java.lang包中可用. isAnnotation()方法用于检查此Class对象是否表示注释类型. isAnnota ...

  5. java parsefloat 误差_Java Float类parseFloat()方法与示例

    Float类parseFloat()方法parseFloat()方法在java.lang包中可用. parseFloat()方法用于返回与给定String表示形式相对应的float值,换句话说,我们可 ...

  6. java compareto long_Java Long类compareTo()方法与示例

    Long类compareTo()方法compareTo()方法在java.lang包中可用. compareTo()方法用于在数学上检查该Long对象与给定Long对象的相等性或不相等性,换句话说,可 ...

  7. java getmethod类_Java Class类 getMethod()方法及示例

    Class类getMethod()方法getMethod()方法在java.lang包中可用. getMethod()方法用于返回Method对象,这些对象指示该类的给定公共方法或由此Class对象表 ...

  8. JAVA的infinite_Java Float类isInfinite()方法与示例

    语法:public boolean isInfinite (); public static boolean isInfinite (float value); Float类isInfinite()方 ...

  9. java class getfield_Java Class类 getField()方法及示例

    Class类getField()方法getField()方法在java.lang包中可用. getField()方法用于返回一个Field对象,该对象指示该类的给定公共成员字段或由此Class对象表示 ...

最新文章

  1. linux xampp eclipse xdebug 无法进入断点
  2. 有关try..catch..finally处理异常的总结
  3. printf与sprintf
  4. php中文网第七期课程目录,php中文网第七期
  5. uva 10099 The Tourist Guide
  6. xgboost使用调参
  7. HDU4372(第一类斯特林数)
  8. Hadoop入门(十二)Intellij IDEA远程向hadoop集群提交mapreduce作业
  9. requestAnimationFrame()
  10. 百度地图迁徙大数据_百度地图迁徙大数据:除武汉外多地出行趋势回升
  11. 读《费曼学习法》有感
  12. 计算机网络技术报告一份,计算机网络技术》实验的报告.doc
  13. 东北大学材料成型工艺学中期末复习
  14. 计算机显卡调研,75%以上的人都想换显卡! MC调研报告告诉你吃鸡“帧”香
  15. 常用二十六大学术搜素引擎
  16. 第六届材料表面与界面国际研讨会(SIM-BT 2019)
  17. K8S系列:Pod 的恢复策略restartPolicy
  18. RFM模型与Spark实现
  19. MAC 安装 pyenv
  20. 申报山西省“专精特新”中小企业需要具备哪些条件?

热门文章

  1. ajax修改按钮的html值,ajax - 在yii 1中使用ajax根据选定的单选按钮选项更新html字段值 - 堆栈内存溢出...
  2. 虚拟服务器关机怎么开,云服务器关机了怎么开启
  3. php order by where,无合适where条件过滤时尽量选择order by后的字段以驱动表进行查询...
  4. React-router的基本使用
  5. leetcode 796. 旋转字符串(Rotate String)
  6. 使用Gitolite搭建Gitserver
  7. C++细节系列(零):零散记录
  8. PowerShell_9_零基础自学课程_9_高级主题:静态类和类的操作
  9. html5储存类型特点,避免踩雷!你不得不知的 HTML5 “新”特性
  10. 公众平台模板消息所在行业_第三方工具微信公众号模板消息群发如何操作?