dispatchnullprogramid.java
来自「java 与COM组件的连接桥」· Java 代码 · 共 33 行
JAVA
33 行
package com.jacob.com;
/**
* This test verifies that the Dispatch object protects itself when
* the constructor is called with a null program id.
* Prior to this protection, the VM might crash.m
* @author joe
*
*/
public class DispatchNullProgramId {
public static void main(String[] args) {
try {
String nullParam = null;
new Dispatch(nullParam);
System.out.println(
"the dispatch failed to protect itself from null program ids");
} catch (IllegalArgumentException iae){
System.out.println(
"the dispatch protected itself from null program ids");
}
try {
String nullParam = "";
new Dispatch(nullParam);
System.out.println(
"the dispatch failed to protect itself from empty string program ids");
} catch (IllegalArgumentException iae){
System.out.println(
"the dispatch protected itself from empty string program ids");
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?