aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes IO question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "IO question" Watch "IO question" New topic
Author

IO question

Holmes Wong
Ranch Hand

Joined: Feb 18, 2002
Posts: 163
Can someone please explain this? Thanks.
Suppose we copy IO.class from C:\java\dir1 to c:\java

What will be the output of running "java IO" from C:\java.
a) C:\java\12345.msg
C:\java\..\12345.msg
b) C:\12345.msg
C:\java\..\12345.msg
c) C:\java\..\12345.msg
C:\java\\..\12345.msg
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
what does IO.class do? Could you provide the source?


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
Holmes Wong
Ranch Hand

Joined: Feb 18, 2002
Posts: 163
Originally posted by Valentin Crettaz:
what does IO.class do? Could you provide the source?

I am sorry.
Here is the source:
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);
}
}
}
[ February 20, 2002: Message edited by: Holmes Wong ]
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
Is it question 38 ??
If yes then IO.class refers to the one presented in question 37 I guess...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: IO question