我想在 .txt 文件中写入字符串数组。但是在运行我的代码后,我得到了一个空文件。这是我的代码。
public void DataSave() throws IOException {
File fout = new File("Data.txt");
FileOutputStream fos = new FileOutputStream(fout);
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos));
String[] numberOfProperty = new String[3];
numberOfProperty[0] = "1";
numberOfProperty[1] = "3";
numberOfProperty[2] = "4";
for (int i = 0; i < numberOfProperty.length; i++) {
bw.write(numberOfProperty[i]);
bw.newLine();
}
}
Run Code Online (Sandbox Code Playgroud)
我的代码有什么问题我无法理解。编译器没有显示错误。请帮忙。所有答案将不胜感激。
我正在使用react-responsive-carousel在react中添加carousel。这是我的代码:
<Carousel autoPlay interval="5000" transitionTime="5000">
<div>
<img src="https://picsum.photos/700/400?img=1" />
<p className="legend">My Classic Still 1</p>
</div>
<div>
<img src="https://picsum.photos/700/400?img=2" />
<p className="legend">My Classic Still 2</p>
</div>
<div>
<img src="https://picsum.photos/700/400?img=3" />
<p className="legend">My Classic Still 3</p>
</div>
</Carousel>
Run Code Online (Sandbox Code Playgroud)