国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

Java核心代碼例程之:HelloWorld.java(2)

2019-11-18 15:14:51
字體:
來源:轉載
供稿:網友

import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;

/**
 * <code>main()</code> invokes "Hello world" reflectively.
 **/

public class HelloWorld
{
  public static void main( String[] args )
  {
    Class outClass = System.out.getClass();
    Class[] argTypes = new Class[] ;

    try
    {
      Method PRintMethod = outClass.getMethod( "println", argTypes );
      printMethod.invoke( System.out, new Object[]  );
    }
    catch ( NoSUChMethodException e )
    {
      System.err.println( "Can"t find method: " + e.getMessage() );
    }
    catch ( SecurityException e )
    {
      System.err.println( "Can"t find method: " + e.getMessage() );
    }
    catch ( IllegalaccessException e )
    {
      System.err.println( "Can"t invoke method: " + e.getMessage() );
    }
    catch ( IllegalArgumentException e )
    {
      System.err.println( "Can"t invoke method: " + e.getMessage() );
    }
    catch ( InvocationTargetException e )
    {
      System.err.println( "Can"t invoke method, threw: " 
                          + e.getTargetException().getMessage() );
    }
  }
}

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 云林县| 南丰县| 浪卡子县| 凉山| 华池县| 颍上县| 武山县| 顺平县| 东海县| 建德市| 定边县| 吐鲁番市| 绵阳市| 平泉县| 柯坪县| 闽侯县| 漠河县| 西平县| 大渡口区| 双城市| 手机| 扎赉特旗| 博白县| 开鲁县| 西平县| 芷江| 朝阳市| 容城县| 建平县| 山东省| 白玉县| 洪湖市| 琼结县| 体育| 香港| 勃利县| 大石桥市| 济阳县| 房山区| 巴中市| 淮安市|