我才接触JAVA,想试下.
    本来我想获得本机的IP.就编个applet程序.用APPLICATION试确定IP运行良好.但在applet里总不行,这是什么原因?import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import java.net.*;
public class MyApp extends Applet implements ActionListener
{
TextArea te=new TextArea(20,40);
Button bu=new Button("本地地址");
MyApp me;
InetAddress mystr=null;
public void init()
{
add(te);
add(bu);
bu.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
te.append("over");
mystr=me.getip();
te.append("your address:"+mystr);
}
public InetAddress getip()
{
try
{
mystr=InetAddress.getLocalHost();
}
catch(UnknownHostException e) {}
return (mystr);
}
}