游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1699|回复: 0

J2SE 5.0的static import wxh zt

[复制链接]

1367

主题

1993

帖子

2118

积分

金牌会员

Rank: 6Rank: 6

积分
2118
发表于 2006-5-14 19:54:00 | 显示全部楼层 |阅读模式

作者:未知 声明:本站收集的源码来自互联网,经过了管理员的细心整理,提供给开发者学习之用。未经本站允许请勿转载!
import static java.lang.System.err;
import static java.lang.System.out;

import java.io.IOException;
import java.io.PrintStream;

public class StaticImporter {

  public static void writeError(PrintStream err, String msg)
    throws IOException {
    // Note that err in the parameter list overshadows the imported err
    err.println(msg);
  }

  public static void main(String[] args) {
    out.println("Good morning, " + "java2s");
    out.println("Have a day!");

    try {
      writeError(System.out, "Error occurred.");
    } catch (IOException e) {   e.printStackTrace();
    }
  }
}


您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2026-1-24 12:53

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表