package Test10月.Test1008;
import org.junit.Test;
import java.io.IOException;
import java.io.InputStreamReader;
public class Test1008Test {
@Test
public void test() {
try (InputStreamReader inputStreamReader = new InputStreamReader(System.in)) {
char[] chars = new char[1024];
int len;
if ((len = inputStreamReader.read(chars)) != -1) {
System.out.println(chars.toString());
}
} catch (IOException e) {
e.printStackTrace();
}
}
@Test
public void test2() {
InputStreamReader inputStreamReader = new InputStreamReader(System.in);
try (inputStreamReader) {
char[] chars = new char[1024];
int len;
if ((len = inputStreamReader.read(chars)) != -1) {
System.out.println(chars.toString());
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
转载请注明原文地址:https://blackberry.8miu.com/read-42103.html