本文介绍了请帮我解决这个java程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 编写一个接收命令行的程序作为 以及单词和文件名的参数。该程序将 字出现删除文件而不立即在内存中加载整个 文件。 使用System; 使用System.Collections.Generic; 使用System.Linq; 使用System.Text; 使用System.IO; 命名空间program1 { class 程序 { public static void stergere(string fis,string cuv) { string numefis = fis; StreamReader sr = new StreamReader(numefis); StreamWriter sw = new StreamWriter( elena .TXT); String strLine; while ((strLine = sr.ReadLine())!= null) { sw.WriteLine( strLine.Replace(cuv, )); } sr.Close(); sw.Close(); } 静态 void Main(string [] args) { String fis,cuv; FileStream fs; Console.Write( introductionti numele fisierului:); fis = Console.ReadLine(); Console.Write( introductionti cuvantul care vreti sa fie sters:); cuv = Console.ReadLine(); 尝试 { fs = new FileStream (cuv.ToString(),FileMode.Open,FileAccess.Read); fs.Close(); } catch (FileNotFoundException a) { Console.WriteLine(a.ToString()); } stergere(fis,cuv); } } } 我写了这段代码但我只是删除如果发现简单的单词搜索单词到那里的另一个单词并删除单词解决方案 我们不做你的作业:它是有原因的。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。 亲自尝试,你可能会发现它不是和你想的一样困难! Write a program that receives the command line asand parameters of a word and a file name. The program willword appearances delete the file without loading entirefile in memory at once.using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO; namespace program1{ class Program { public static void stergere(string fis, string cuv) { string numefis = fis; StreamReader sr = new StreamReader(numefis); StreamWriter sw = new StreamWriter("elena.txt"); String strLine; while ((strLine= sr.ReadLine())!= null) { sw.WriteLine(strLine.Replace( cuv , " ")); } sr.Close(); sw.Close(); } static void Main(string[] args) { String fis, cuv; FileStream fs; Console.Write("introduceti numele fisierului: "); fis = Console.ReadLine(); Console.Write(" introduceti cuvantul care vreti sa fie sters: "); cuv = Console.ReadLine(); try { fs = new FileStream(cuv.ToString(), FileMode.Open, FileAccess.Read); fs.Close(); } catch (FileNotFoundException a) { Console.WriteLine(a.ToString()); } stergere(fis, cuv); } }}I wrote this code but instead I just delete if found simple word search word into another word there and delete word 解决方案 We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.Try it yourself, you may find it is not as difficult as you think! 这篇关于请帮我解决这个java程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-17 12:50