我如何...创建一个程序,使用文本文件执行不同的事务? [英] How do i...create a program that will execute different transactions using text file?
问题描述
有人可以展示如何创建一个程序,使用文本文件执行不同的事务。在程序中使用if else,开关,循环,数组,方法调用和异常处理。
[C]按C创建文本文件
[R]按R将数据读取到文件
[U]按U将数据更新到文件
[DF]按D删除文件>
[E]按E退出
输入您的选择:
希望得到您的帮助...谢谢
我的尝试:
我已经尝试过了YouTube上。谷歌已经google了。
i相信这是如何正确创建文件的?
包试用;
import java .util。*;
公共类Firstfile {
public static void main(String [] args)
{
final格式化a;
尝试{
a = new Formatter(linares.txt) ;
System.out.println(你成功创建了文件);
}
catch(例外e){
System.out.println(错误);
}
}
}
访问了这些链接,搜索答案:
Java编程帮助 [ ^ ]
file io - java替换特定的字符串在文本文件中 - Stack Overflow [ ^ ]
Java编程教程 - 79 - 创建文件 - YouTube [ ^ ]
扫描程序类3第3部分:阅读文本文件(Java) - YouTube [ ^ ]
很抱歉,但本网站不提供订购代码。请参阅 Java™教程 [ ^ ]。
good day! can you please help me understand how to execute this java program. I'm a beginner.
can somebody show how to create a program that will execute different transactions using text file. using if else, switch, loops, arrays, method calling and exception handling in program.
[C] Press C to create a text file
[R] Press R to read data to file
[U] Press U to update data to file
[DF] Press D to delete the file
[E] Press E to exit
Input your choice:
hoping for your kind help...thank you
What I have tried:
I already tried to seach in youtube. googled it already.
i believe this is how to create file right?
package tryout;
import java.util.*;
public class Firstfile {
public static void main(String []args)
{
final Formatter a;
try{
a = new Formatter("linares.txt");
System.out.println("you created file successfully");
}
catch(Exception e){
System.out.println("error");
}
}
}
visited these links, searching for answers:
Java Programming Help[^]
file io - java replace specific string in textfile - Stack Overflow[^]
Java Programming Tutorial - 79 - Creating Files - YouTube[^]
Scanner Class 3 Part 3: Reading Text Files (Java) - YouTube[^]
Sorry, but this site does not provide code to order. See The Java™ Tutorials[^].
这篇关于我如何...创建一个程序,使用文本文件执行不同的事务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!