±Û¾´ÀÌ :¼Û¿µÀÍ 1999³â 6¿ù 22ÀÏ 09:19:36
´ÙÀ½ÀÇ ´äÀÌ ¿Ö ±×·¸°Ô µÅ´ÂÁö °¡¸£ÃÄ Áֽʽÿä..
Q37) Consider a directory structure like this (NT or 95)
C:\JAVA\12345.msg --FILE
\dir1\IO.class -- IO.class is under dir1
Consider the following code
import java.io.*;
public class IO {
public static void main(String args[]) {
File f = new File("..\\12345.msg");
try{
System.out.println(f.getCanonicalPath());
System.out.println(f.getAbsolutePath());
}catch(IOException e){
System.out.println(e);
}
}
}
What will be the output of running "java IO" from C:\java\dir1
a) C:\java\12345.msg c====
C:\java\dir1\..\12345.msg
Q41) What will be the output
Consider a directory structure like this (NT or 95)
C:\JAVA\12345.msg --FILE
import java.io.*;
public class IO {
public static void main(String args[]) {
File f1 = new File("\\12345.msg");
System.out.println(f1.getPath());
System.out.println(f1.getParent());
System.out.println(f1.isAbsolute());
System.out.println(f1.getName());
System.out.println(f1.exists());
System.out.println(f1.isFile());
}
}
d) \12345.msg
\
true
12345.msg
false
false