package InputStreamDemo; import java.io.File; import java.io.IOException; public class RandomAccessFileDemo { RandomAccessFileDemo()throws IOException{ File Demo = new File("Demo"); if(!Demo.exists()){ Demo.mkdir(); } File file = new File(Demo,"file.txt"); if(!file.exists()){ file.createNewFile(); } } public static void main(String[] args) { try{ new RandomAccessFileDemo(); }catch(Exception e){ } } }
你确定刷新了?代码没错!重新创个项目再把代码复制进去试下