ÓÉJava toy programme µÃ³öµÄ¾Ñé¼°½Ìѵ
ѧϰJava´ó¸ÅÒ»¸öÔÂÁË£¬ÓÉÓÚÒÔÇ°ÓÐc/c++»ù´¡£¬ËùÒÔÔÚJ2SE²¿·ÖµÄѧϰÊDZȽϿìµÄ£¬½ñÌìÔÚÂÛ̳¿´µ½Ò»¸öÍøÓѵÄÇóÖúÌû£¬Òª½«Ó²ÅÌÉÏÁ½¸öÎļþºÏ²¢ÎªÒ»¸ö²¢É¾³ýÔÎļþ£¬ÓÚÊDZãдÁ˲âÊÔ³ÌÐò¡£ºóÀ´ÔÚɾ³ýÎļþʱ£¬ÓÉÓÚûÓаѶµ½ÎļþÉϵÄÊä³öÁ÷¹Ø±Õ£¬µ¼ÖÂÔõôҲÎÞ·¨É¾³ý¡£¶øÇÒÒ»Ö±²é²»³öÔÒò£¬ºóÀ´ÒÔΪÊÇdelete·½·¨Ö»ÄÜɾ³ý¿ÕÎļþ£¬Ò»google£¬ÔÚ¿´Ìû¹ý³ÌÖÐͻȻÒâʶµ½×Ô¼ºµÄÊä³öÁ÷û¹Ø±Õ£¬Ð޸ijÌÐòºó£¬Õý³£ÁË¡£´ÓÖУ¬Ìå»áµ½Ð´³ÌÐòºÃÏ°¹ßÕæµÄÊǺÜÖØÒªµÄ¡£¼ÌÐø³É³¤ing¡£¡£¡£¡£¡£¡£¡£¡£
java code
import java.io.*;
public class HandleFile {
public static void main(String[] args) throws Exception {
if(args.length == 0) return ;
else{
File[] f = new File[args.length];
File objectFile = new File("G:\\object.txt");
BufferedReader buf = null;
BufferedWriter bw = new BufferedWriter(new FileWriter(objectFile));
String line = null;
for(int i=0; i<args.length; i++) {
f[i] = new File(args[i]);
System.out.println(f[i]);
buf = new BufferedReader(new FileReader(f[i]));
line = buf.readLine();
while(line != null) {
bw.write(line);
bw.flush();
bw.newLine();
line = buf.readLine();
if(line == null) {
buf.close();
System.out.println("µÚ" + i +"¸öÎļþÍê±Ï");
if(f[i].delete()) System.out.println("ÒÑɾ³ý");
}
}
}
}
}
}
Ïà¹ØÎĵµ£º
ËäÈ»Óà Java™ ÓïÑÔ±àдµÄ³ÌÐòÔÚÀíÂÛÉÏÊDz»»á³öÏÖ“ÄÚ´æй©”µÄ£¬µ«ÊÇÓÐʱ¶ÔÏóÔÚ²»ÔÙ×÷Ϊ³ÌÐòµÄÂ߼״̬µÄÒ»²¿·ÖÖ®ºóÈÔÈ»²»±»À¬»øÊÕ¼¯¡£±¾Ô£¬¸ºÔð±£ÕÏÓ¦ÓóÌÐò½¡¿µµÄ¹¤³Ìʦ Brian Goetz ̽ÌÖÁËÎÞÒâʶµÄ¶ÔÏó±£ÁôµÄ³£¼ûÔÒò£¬²¢Õ¹Ê¾ÁËÈçºÎÓÃÈõÒýÓöÂסй©¡£
ÒªÈÃÀ¬»øÊÕ¼¯£¨GC£©»ØÊÕ³ÌÐò²»ÔÙʹÓõĶÔÏ󣬶 ......
import java.io.*;
public class CheckVirusFile
{
int virusCount=0,del_count=0,spe_count=0,nameCount=0;
//ÓõݹéµÄ·½·¨¼ì²éFileÀàÐ͵IJÎÊýÊÇÎļþ»¹ÊÇĿ¼
public void judgeDir(File virFile)
{
if(!virFile.isDir ......
ÔÚ Java ÀíÂÛºÍʵ¼ù µÄ Ç°Ò»ÆÚÎÄÕ ÖУ¬Java™ Çå½à¹¤³Ìʦ Brian Goetz ̽¾¿ÁËÈõÒýÓã¨weak references£©£¬ËüÈÃÄú¾¯¸æÀ¬»øÊÕ¼¯Æ÷£¬ÄúÏëҪά»¤Ò»¸ö¶ÔÏóµÄÒýÓ㬶ø²»»á×èÖ¹¸Ã¶ÔÏó±»À¬»øÊÕ¼¯¡£ÔÚ±¾ÆÚÎÄÕÂÖУ¬Ëû½«½âÊÍ Reference ¶ÔÏóµÄÁíÍâÒ»ÖÖÐÎʽ£¬¼´ÈíÒýÓã¨soft references£©£¬ÓÃÓÚ°ïÖúÀ¬»øÊÕ¼¯Æ÷¹ÜÀíÄÚ´æʹÓúÍÏû³ýÇ ......
×÷ΪJava³ÌÐòÔ±À´Ëµ£¬×îÍ´¿àµÄÊÂÇéĪ¹ýÓÚ¿ÉÒÔÑ¡ÔñµÄ·¶Î§Ì«¹ã£¬¿ÉÒÔ¶ÁµÄÊéÌ«¶à£¬ÍùÍùÈÝÒ×ÎÞËùÊÊ´Ó¡£ÎÒÏë¾ÍÎÒ×Ô¼º¶Á¹ýµÄ¼¼ÊõÊé¼®ÖÐÌôÑ¡³öÀ´Ò»Ð©£¬
°´ÕÕѧϰµÄÏȺó˳Ðò£¬ÍƼö¸ø´ó¼Ò£¬ÌرðÊÇÄÇЩÏë²»¶ÏÌá¸ß×Ô¼º¼¼ÊõˮƽµÄJava³ÌÐòÔ±ÃÇ¡£
Ò»¡¢Java±à³ÌÈëÃÅÀà
¶ÔÓÚûÓÐJava±à³Ì¾ÑéµÄJava³ÌÐòÔ±ÒªÈëÃÅ£¬Ëæ±ã¶ÁʲôÈëÃÅÊé¼®¶¼Ò» ......
JAVAËÄÖÖ»ù±¾ÅÅÐò,°üÀ¨Ã°ÅÝ·¨,²åÈë·¨,Ñ¡Ôñ·¨,SHELLÅÅÐò·¨.ÆäÖÐÑ¡Ôñ·¨ÊÇðÅÝ·¨µÄ¸Ä½ø,SHELLÅÅÐò·¨ÊÇ ²åÈë·¨µÄ¸Ä½ø.ËùÒÔ´Ó¸ù±¾ÉÏÀ´Ëµ¿ÉÒÔ¹éÄÉΪÁ½ÖÖ²»Í¬µÄÅÅÐò·½·¨:¼´:²åÈë·¨£¦Ã°ÅÝ·¨
Ò» ²åÈë·¨:±éÀúÅÅÐò¼¯ºÏ£¬Ã¿µ½Ò»¸öÔªËØʱ£¬¶¼Òª½«Õâ¸öÔªËØÓëËùÓÐËü֮ǰµÄÔªËرéÀú±È½ÏÒ»±é£¬È÷ûºÏÅÅÐò˳ÐòµÄÔªËØ°¤¸öÒƶ¯µ½µ±Ç°·¶Î§ÄÚËü×î ......