日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程语言 > java >内容正文

java

system.setin_Java System类setIn()方法及示例

發(fā)布時(shí)間:2023/12/1 java 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 system.setin_Java System类setIn()方法及示例 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

system.setin

系統(tǒng)類(lèi)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()方法用于再次分配標(biāo)準(zhǔn)輸入流。

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

    setIn()方法被重定向,因?yàn)樗粡木庉嬈髯x取輸入。

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

    setIn()方法從標(biāo)準(zhǔn)輸入流中讀取輸入。

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

    setIn()方法是靜態(tài)方法,也可以使用類(lèi)名進(jìn)行訪問(wèn)。

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

    從標(biāo)準(zhǔn)輸入流中讀取輸入時(shí), setIn()方法可能會(huì)引發(fā)異常:

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

    SecurityException:在此異常中,當(dāng)存在安全管理器時(shí),checkPermission()方法不允許重新分配最新的標(biāo)準(zhǔn)輸入流。

Syntax:

句法:

public static void setIn(InputStream set_in);

Parameter(s):

參數(shù):

  • InputStream set_in – represents the latest standard input stream.

    InputStream set_in –表示最新的標(biāo)準(zhǔn)輸入流。

Return value:

返回值:

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

此方法的返回類(lèi)型為void ,它不返回任何內(nèi)容。

Example:

例:

// Java program to demonstrate the example of // setIn () method of System Classimport java.lang.*; import java.io.*;public class SetInMethod {public static void main(String[] args) throws Exception {// Display file in a specific mannerSystem.setIn(new FileInputStream("E://Programs//getProperties().doc"));// Read the first character in the filechar read_first_char = (char) System.in.read();// Display first character of the FileSystem.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

總結(jié)

以上是生活随笔為你收集整理的system.setin_Java System类setIn()方法及示例的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。