Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

java ²é¿´Îļþ¼ÐÏÂÃæËùÓÐÎļþÒÔ¼°Îļþ¼Ð

import java.io.File;
import java.util.Date;
import java.util.Iterator;
import java.util.Vector;
import java.text.SimpleDateFormat;
public class FileViewer {
  File myDir;
  File[] contents;
  Vector vectorList;
  Iterator currentFileView;
  File currentFile;
  String path;
  public FileViewer() {
    path = new String("");
    vectorList = new Vector();
  }
  public FileViewer(String path) {
    this.path = path;
    vectorList = new Vector();
  }
  /**
   * ÉèÖÃä¯ÀÀµÄ·¾¶
   */
  public void setPath(String path) {
    this.path = path;
  }
  /***
   * ·µ»Øµ±Ç°Ä¿Â¼Â·¾¶
   */
  public String getDirectory() {
    return myDir.getPath();
  }
  /**
   * Ë¢ÐÂÁбí
   */
  public void refreshList() {
    if (this.path.equals("")) {
      path = "c:\\";
    }
    myDir = new File(path);
    vectorList.clear();
    contents = myDir.listFiles();
    //ÖØÐÂ×°Èë·¾¶ÏÂÎļþ
    for (int i = 0; i < contents.length; i++) {
      vectorList.add(contents[i]);
    }
    currentFileView = vectorList.iterator();
  }
  /**
   * Òƶ¯µ±Ç°Îļþ¼¯ºÏµÄÖ¸ÕëÖ¸µ½ÏÂÒ»¸öÌõÄ¿
   * @return ³É¹¦·µ»Øtrue,·ñÔòfalse
   */
  public boolean nextFile() {
    while (currentFileView.hasNext()) {
      currentFile = (File) currentFileView.next();
      return true;
    }
    return false;
  }
  /**
   * ·µ»Øµ±Ç°Ö¸ÏòµÄÎļþ¶ÔÏóµÄÎļþÃû³Æ
   */
  public String


Ïà¹ØÎĵµ£º

javaÊý×ֵĸñʽ»¯

1)   ¸ñʽ»¯ÕûÊý(°Ñ¸¡µãÊýת»¯ÎªÕûÊý)
       NumberFormat nf = NumberFormat.getIntegerInstance();
       double v=12.6;
       System.out.println(nf.format(v));
       Êä³ö½ ......

ÈçºÎÓÃÃüÁîÐÐÔËÐÐjava³ÌÐò¼°ÊäÈëmainº¯Êý²ÎÊýµÄÊäÈë

Ç°Ì᣺JDKÔÚ»·¾³±äÁ¿ÀïÓÐÅäÖà 1.Ê×ÏȽ¨¸ö¹¤³ÌTest£¨¼ÙÈç·ÅÓÚD:\java£©½«srcĿ¼ÏµÄÎļþ¿½±´µ½classesĿ¼Ï 2.ÔËÐÐÀïÊäÈëcmd->»Ø³µ 3.ÊäÈëD:->»Ø³µ 4.ÊäÈëcd java»Ø³µ(cdδ´ò¿ªÎļþ¼Ð) 5.ÊäÈëcd test->»Ø³µ 6.ÊäÈëcd classes->»Ø³µ 7.ÊäÈëdir->»Ø³µ£¨dirΪÏÔʾ¸ÃĿ¼ÏµÄËùÓÐÎļþ£© 8.¶Ôÿ¸ö.javaÎ ......

javaÒýÓÃ


class Tank{
 int level;
}
public class Assignment {
 public static void main(String[] args) {
  
  Tank t1 = new Tank();
  Tank t2 = new Tank();
  t1.level= 9;
  t2.level= 47;
  
  System.out.println("1:t1.l ......

ѧJAVAÐèÒªÕÆÎյļ¼Êõ¼°Á÷³Ì


ѧJAVAÐèÒªÕÆÎյļ¼Êõ¼°Á÷³Ì
¶ÔÓÚjava³õѧÕßÀ´ËµÅÓ´óµÄJavaÓïÑÔ²»Öªµ½´ÓÄÄÀïÈëÊÖ¿ªÊ¼Ñ§Ï°£¬Ò²²»ÖªµÀ¶¼ÒªÑ§Ð©Ê²Ã´²ÅÄÜ·ûºÏÆóÒµµÄÒªÇó£¬ÒÔÏÂÊÇjava˽ÛÓ¸ù¾Ý¼¼ÊõµÄ¸üжøµ÷ÕûµÄ×îнÌѧÄÚÈݼ°Á÷³Ì£¬¹©´ó¼Ò²Î¿¼¡£
1.javaµÄ»ù´¡ÖªÊ¶
²»Òª±»Ð¼¼ÊõÃÔ»ó£¬ËùνÍò±ä²»ÀëÆä×Ú£¬Ð¼¼Êõ¶¼ÊÇ»ùÓÚjavaµÄ»ù´¡Ö®ÉÏ£¬Èç¹û»ù´¡²»Ôúʵ£¬¶Ô ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ