hellostringifiedclient.java

来自「初级学习资料必读本」· Java 代码 · 共 34 行

JAVA
34
字号
// HelloStringifiedClient.java, stringified object reference versionimport java.io.*;import org.omg.CORBA.*;import HelloApp.*;public class HelloStringifiedClient {    public static void main(String args[])    {	try{	    // create and initialize the ORB	    ORB orb = ORB.init(args, null);	    // Get the stringified object reference and destringify it.	    String filename = System.getProperty("user.home")+	        System.getProperty("file.separator")+"HelloIOR";	    BufferedReader br = new BufferedReader(new FileReader(filename));            String ior = br.readLine();            org.omg.CORBA.Object obj = orb.string_to_object(ior);            Hello helloRef = HelloHelper.narrow(obj);	    // call the Hello server object and print results	    String hello = helloRef.sayHello();	    System.out.println(hello);	} catch (Exception e) {	    System.out.println("ERROR : " + e) ;	    e.printStackTrace(System.out);	}    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?