main类正在接受用户输入作为文件名。
vtable
但问题是我想使用构造函数创建一个文件对象。我对java很陌生,所以对此有所帮助。
答案 0 :(得分:-1)
在FileOperator类中创建构造函数:
public class FileOperator{
public FileOperator(String filename){
// here write fileOperator method code and delete that method
}
}
in main delete FileOperator fileObject = new FileOperator(); // and write in else part
{
FileOperator fileObject = new FileOperator(userInput)
}