file类是用来显示某个目录包含文件的信息的,主要是能把符合条件的文件名都读书来
Dimension就不知道了你是不是在用JB???
建议刚学的时候不要用JB,那样打不好基础

解决方案 »

  1.   

    java.awt.Dimension
    The Dimension class encapsulates the width and height of a component (in integer precision) in a single object. The class is associated with certain properties of components. Several methods defined by the Component class and the LayoutManager interface return a Dimension object. Normally the values of width and height are non-negative integers. The constructors that allow you to create a dimension do not prevent you from setting a negative value for these properties. If the value of width or height is negative, the behavior of some methods defined by other objects is undefined. java.io.File
    An abstract representation of file and directory pathnames. User interfaces and operating systems use system-dependent pathname strings to name files and directories. This class presents an abstract, system-independent view of hierarchical pathnames. An abstract pathname has two components: An optional system-dependent prefix string, such as a disk-drive specifier, "/" for the UNIX root directory, or "\\" for a Microsoft Windows UNC pathname, and 
    A sequence of zero or more string names. 
    Each name in an abstract pathname except for the last denotes a directory; the last name may denote either a directory or a file. The empty abstract pathname has no prefix and an empty name sequence. 
    The conversion of a pathname string to or from an abstract pathname is inherently system-dependent. When an abstract pathname is converted into a pathname string, each name is separated from the next by a single copy of the default separator character. The default name-separator character is defined by the system property file.separator, and is made available in the public static fields separator and separatorChar of this class. When a pathname string is converted into an abstract pathname, the names within it may be separated by the default name-separator character or by any other name-separator character that is supported by the underlying system. A pathname, whether abstract or in string form, may be either absolute or relative. An absolute pathname is complete in that no other information is required in order to locate the file that it denotes. A relative pathname, in contrast, must be interpreted in terms of information taken from some other pathname. By default the classes in the java.io package always resolve relative pathnames against the current user directory. This directory is named by the system property user.dir, and is typically the directory in which the Java virtual machine was invoked. The prefix concept is used to handle root directories on UNIX platforms, and drive specifiers, root directories and UNC pathnames on Microsoft Windows platforms, as follows: For UNIX platforms, the prefix of an absolute pathname is always "/". Relative pathnames have no prefix. The abstract pathname denoting the root directory has the prefix "/" and an empty name sequence. 
    For Microsoft Windows platforms, the prefix of a pathname that contains a drive specifier consists of the drive letter followed by ":" and possibly followed by "\" if the pathname is absolute. The prefix of a UNC pathname is "\\"; the hostname and the share name are the first two names in the name sequence. A relative pathname that does not specify a drive has no prefix. 
    Instances of the File class are immutable; that is, once created, the abstract pathname represented by a File object will never change. 
      

  2.   

    The Dimension class encapsulates the width and height of a component (in integer precision) in a single object. The class is associated with certain properties of components. Several methods defined by the Component class and the LayoutManager interface return a Dimension object. 
      

  3.   

    package java.awt;import java.awt.geom.Dimension2D;
    public class Dimension extends Dimension2D implements java.io.Serializable {
        
        /**
         * The width dimension; negative values can be used. 
         *
         * @serial
         * @see #getSize
         * @see #setSize
         */
        public int width;    /**
         * The height dimension; negative values can be used. 
         *
         * @serial
         * @see #getSize
         * @see #setSize
         */
        public int height;    /*
         * JDK 1.1 serialVersionUID 
         */
         private static final long serialVersionUID = 4723952579491349524L;    /**
         * Initialize JNI field and method IDs
         */
        private static native void initIDs();    static {
            /* ensure that the necessary native libraries are loaded */
    Toolkit.loadLibraries();
            if (!GraphicsEnvironment.isHeadless()) {
                initIDs();
            }
        }    /** 
         * Creates an instance of <code>Dimension</code> with a width 
         * of zero and a height of zero. 
         */
        public Dimension() {
    this(0, 0);
        }    /** 
         * Creates an instance of <code>Dimension</code> whose width  
         * and height are the same as for the specified dimension. 
         *
         * @param    d   the specified dimension for the 
         *               <code>width</code> and 
         *               <code>height</code> values
         */
        public Dimension(Dimension d) {
    this(d.width, d.height);
        }    /** 
         * Constructs a <code>Dimension</code> and initializes
         * it to the specified width and specified height.
         *
         * @param width the specified width 
         * @param height the specified height
         */
        public Dimension(int width, int height) {
    this.width = width;
    this.height = height;
        }    /**
         * Returns the width of this dimension in double precision.
         * @return the width of this dimension in double precision
         */
        public double getWidth() {
    return width;
        }    /**
         * Returns the height of this dimension in double precision.
         * @return the height of this dimension in double precision
         */
        public double getHeight() {
    return height;
        }    /**
         * Sets the size of this <code>Dimension</code> object to
         * the specified width and height in double precision.
         * Note that if <code>width</code> or <code>height</code>
         * are larger than <code>Integer.MAX_VALUE</code>, they will
         * be reset to <code>Integer.MAX_VALUE</code>.
         *
         * @param width  the new width for the <code>Dimension</code> object
         * @param height the new height for the <code>Dimension</code> object
         */
        public void setSize(double width, double height) {
    this.width = (int) Math.ceil(width);
    this.height = (int) Math.ceil(height);
        }    /**
         * Gets the size of this <code>Dimension</code> object.
         * This method is included for completeness, to parallel the
         * <code>getSize</code> method defined by <code>Component</code>.
         *
         * @return   the size of this dimension, a new instance of 
         *           <code>Dimension</code> with the same width and height
         * @see      java.awt.Dimension#setSize
         * @see      java.awt.Component#getSize
         * @since    JDK1.1
         */
        public Dimension getSize() {
    return new Dimension(width, height);
        }     /**
         * Sets the size of this <code>Dimension</code> object to the specified size.
         * This method is included for completeness, to parallel the
         * <code>setSize</code> method defined by <code>Component</code>.
         * @param    d  the new size for this <code>Dimension</code> object
         * @see      java.awt.Dimension#getSize
         * @see      java.awt.Component#setSize
         * @since    JDK1.1
         */
        public void setSize(Dimension d) {
    setSize(d.width, d.height);
        }     /**
         * Sets the size of this <code>Dimension</code> object 
         * to the specified width and height.
         * This method is included for completeness, to parallel the
         * <code>setSize</code> method defined by <code>Component</code>.
         *
         * @param    width   the new width for this <code>Dimension</code> object
         * @param    height  the new height for this <code>Dimension</code> object
         * @see      java.awt.Dimension#getSize
         * @see      java.awt.Component#setSize
         * @since    JDK1.1
         */
        public void setSize(int width, int height) {
         this.width = width;
         this.height = height;
        }     /**
         * Checks whether two dimension objects have equal values.
         */
        public boolean equals(Object obj) {
    if (obj instanceof Dimension) {
        Dimension d = (Dimension)obj;
        return (width == d.width) && (height == d.height);
    }
    return false;
        }    /**
         * Returns the hash code for this <code>Dimension</code>.
         *
         * @return    a hash code for this <code>Dimension</code>
         */
        public int hashCode() {
            int sum = width + height;
            return sum * (sum + 1)/2 + width;
        }    /**
         * Returns a string representation of the values of this 
         * <code>Dimension</code> object's <code>height</code> and 
         * <code>width</code> fields. This method is intended to be used only 
         * for debugging purposes, and the content and format of the returned 
         * string may vary between implementations. The returned string may be 
         * empty but may not be <code>null</code>.
         * 
         * @return  a string representation of this <code>Dimension</code> 
         *          object
         */
        public String toString() {
    return getClass().getName() + "[width=" + width + ",height=" + height + "]";
        }
    }
      

  4.   

    file类是对文件系统中一个文件的描述。文件的全名由路径名和文件名组成。
    file类用以机器无关的方法处理文件问题。
    Dimension用以描述组件(Component)的长宽值
      

  5.   

    能举个例子来说明File的用法吗?