我正在为iPhone制作客户端服务器应用程序,并希望知道在iPhone应用程序终止时调用哪个方法.任何帮助,将不胜感激.
这是我写的代码:
super("Add contact");
setLayout(new FlowLayout());
IPAddress = new JLabel("IP Address");
IPAddress.setLocation(1000, 100);
ImageIcon ii=new ImageIcon(getClass().getResource("Add.png"));
JLabel image = new JLabel(ii);
image.setSize(100, 100);
image.setLocation(500, 100);
add(image);
add(IPAddress);
setSize(500,150);
}
Run Code Online (Sandbox Code Playgroud) 这是我的代码
try {
fstream = new FileWriter("/Applications/AirDrop/contacts.txt");
BufferedWriter out = new BufferedWriter(fstream);
out.write(stringToInsert);
out.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
现在我每次尝试调用此方法时(这是代码在一个名为writeToFile的方法中,带有字符串参数)的字符串
我刚开始学习Java,发现你必须事先在数组中设置对象数.那么如何在数组中设置数量,就像在目标c中完成一样.我知道我可以做这样的事情
int a[] = {1,3,1,3,41,34}
Run Code Online (Sandbox Code Playgroud)
但在这种情况下你必须立即放置所有对象有没有办法做到这一点?
谢谢