zoukankan      html  css  js  c++  java
  • new File(e:)和new File(d:)的结果不一样

     1 package fengke.io;
     2 /**
     3  * new File(e:)和new File(d:)的结果不一样
     4  * @author 锋客
     5  * 解释:
     6  *    getAbsolutePath 
     7  *          public String getAbsolutePath()返回抽象路径名的绝对路径名字符串。 
     8  *          如果此抽象路径名已经是绝对路径名,则返回该路径名字符串,这与 getPath() 方法一样。
     9  *          如果此抽象路径名是空的抽象路径名,则返回当前用户目录的路径名字符串,该目录由系统属性 user.dir 指定。
    10  *          否则,使用与系统有关的方式分析此路径名。
    11  *          在 UNIX 系统上,通过根据当前用户目录分析某一相对路径名,可使该路径名成为绝对路径名。
    12  *          在 Microsoft Windows 系统上,通过由路径名指定的当前驱动器目录(如果有)来分析某一相对路径名,
    13  *          可使该路径名成为绝对路径名;否则,可以根据当前用户目录来分析它。 
    14  */
    15 import java.io.File;
    16 
    17 public class FileDemo1 {
    18     
    19     public static void main(String[] args) { 
    20         //.class文件放在e盘
    21         File file = new File("e"); 
    22         System.out.println(file.getAbsolutePath()); 
    23 
    24         file = new File("e:\"); 
    25         System.out.println(file.getAbsolutePath()); 
    26 
    27         file = new File("e:"); 
    28         System.out.println(file.getAbsolutePath()); 
    29         
    30         file = new File("c:"); 
    31         System.out.println(file.getAbsolutePath()); 
    32         
    33         file = new File("c:\"); 
    34         System.out.println(file.getAbsolutePath()); 
    35         
    36         file = new File("d:"); 
    37         System.out.println(file.getAbsolutePath()); 
    38         
    39         file = new File("d:\"); 
    40         System.out.println(file.getAbsolutePath()); 
    41         
    42         
    43         } 
    44       
    45 }
  • 相关阅读:
    .ascx
    *.ascx *.asax *.aspx.resx *.asax.resx是什么文件
    DNN Learning How to install 1
    LG7881 [Ynoi2006] rmpq【分块,分治】
    LG6783 [Ynoi2008] rrusq【扫描线,KDT】
    UOJ681【UR #22】月球列车【二进制,Trie】
    AGC056E Cheese【概率期望,dp】
    AGC055F Creative Splitting【双射转化,dp】
    CTT2022 游记
    NOIP2021 退役记
  • 原文地址:https://www.cnblogs.com/fengke/p/4800300.html
Copyright © 2011-2022 走看看