|
|
350 Mock Questions on SCJP 1.5 - JUST Rs.200 or 7 USD
Send us mail to sales@javabeat.net
more details
|
|
SCJP 5.0 Mock Questions - Java IO Package (10 Questions)
3)Assume that in the current directory test.txt file is already exist. What will happen when
you execute the following code?
import java.io.*;
class Test
{
public static void main(String args[])
{
try
{
File file = new File("test.txt");
file.createNewFile();
}
catch (IOException ex)
{
ex.printStackTrace();
}
}
}
a)text.txt will be created and overwrite the old file
b)file will not be created
c)exception will be thrown
d)none of the above.
Answer
3)c)file will not be created.
New file cannot be created,when the File object refers to an actual file name that already exists in the file system.
|
|
350 Mock Questions on SCJP 1.5 - JUST Rs.200 or 7 USD
Send us mail to sales@javabeat.net
more details
|
|