1 / 6
文档名称:

百度java笔试题(含答案).doc

格式:doc   页数:6
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

百度java笔试题(含答案).doc

上传人:xxj165868 2016/1/29 文件大小:0 KB

下载得到文件列表

百度java笔试题(含答案).doc

相关文档

文档介绍

文档介绍:更多面试题,笔试题解答答案专家回答:第一题简评百度的主要业务是搜索,。,以一定的格式保存在能快速检索的文件系统中。。由以上3点可见,字符串的分析,抽取在搜索引擎中的地位是何等重要。因此,百度的笔试面试题中,出现这样的题就变得理所当然了。以下是该题的java实现,代码如下:.*;.*;.*;/******@authortzy**/lassFileNameStat{privateStringsrcPath;//要统计的文件路径privateMapstatMap;//用于统计的mappublicFileNameStat(StringsrcPath){=srcPath;软件开发网Map=newTreeMap();}/*获得要统计的URL的文件名*/publicStringgetFileName(StringurlString){URLurl=null;StringfilePath=null;StringfileName=null;try{url=newURL(urlString);filePath=();intindex=0;if((index=("/"))!=-1){fileName=(index+1);}else{fileName="";}}catch(MalformedURLExceptione){}returnfileName;}/*统计指定文件名的个数*/publicvoidstat(Stringfilename){Integercount=null;if((filename)!=null){count=(Integer)(filename);count=newInteger(()+1);}else{count=newInteger(1);}(filename,count);}/*统计的主方法*/publicvoidstart()throwsFileNotFoundException,IOException{BufferedReaderbfin=newBufferedReader(newFileReader());Stringtemp=null;while((temp=())!=null){stat(getFileName(temp));}}/*输出统计结果*/publicvoidresult(){Iteratorit=().iterator();while(()){=()(());((().equals("")?"空文件名":())+"的个数是"+