System.in,System.out,System.err既然是final static的,为什么还有setIn(),setOut(),setErr()呢?
解决方案 »
- 新手求教 JComboBox里面设置年月日问题
- InputStreamReader + FileInputStream 跟 Reader应用于文本文件有区别吗?
- iReport中如何将一张大图片分页打印?
- unix下,java 能否实现与客户端的域socket通讯?能的话,如何实现?请大虾们赐教!
- Java JList中能放对象吗(比如:按钮);我刚学
- Native 修饰符的使用
- Test
- 急!!!!!! 哪位老大能帮忙找找 getCustomDatum 的替代方法。
- ¥¥¥到底是什么问题,一个简单的函数,应该怎么写¥¥¥
- 请“路人甲”大侠进来来看看。。。多谢了。。
- 有没有北京的大哥大姐~~有空我想当面向你们学习~~
- 关于怎样释放Image占用的内存。大侠帮忙!分不够再加
System是一个类。类中当然可以有方法了属性了..
setIn 和 setOut就是给in和out赋值。
不过这两个方法是natvie的。
在native里就不需要遵守java规范了
可以仔细看看源码
源码:其中setIn0 是native的
/**
* Reassigns the "standard" input stream.
*
* <p>First, if there is a security manager, its <code>checkPermission</code>
* method is called with a <code>RuntimePermission("setIO")</code> permission
* to see if it's ok to reassign the "standard" input stream.
* <p>
*
* @param in the new standard input stream.
*
* @throws SecurityException
* if a security manager exists and its
* <code>checkPermission</code> method doesn't allow
* reassigning of the standard input stream.
*
* @see SecurityManager#checkPermission
* @see java.lang.RuntimePermission
*
* @since JDK1.1
*/
public static void setIn(InputStream in) {
checkIO();
setIn0(in);
}