网友您好, 请在下方输入框内输入要搜索的题目:
下列Applet用于显示提供它的主机的IP地址。请选择正确的语句填入横线处。 import java.awt.*; import java. awt. event.*; import java.applet.Applet; import java.net. *; public class ex23 extends Applet { public void init() { setLayout(new GridLayout(2, 1); Button btm = new Button("显示IP"); final Label 1 = new Label(" "); btn. addActionListener (new ActionListener ( ) { public void actionPerformed(ActionEvent ae) { try { URL ur1 = getCodeBase(); String strName = ur1.getHost(); ______ 1.setText (ia.toString()); } catch (Exception e) { e.printStackTrace (); } } }); add (btn); } }
A.InetAddress ia = URL.getByName(strName);
B.InetAddress ia = InetAddress.getByName(strName);
C.InetAddress ia = new InetAddress.getByName(strName);
D.InetAddress ia = InetAddress.getByName(ur1);
参考答案