Sweety C Sanford

Greenhorn
+ Follow
since Feb 11, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sweety C Sanford

In Flow Control......
13 years ago
Hi all,

I have cleared SCJP with 98% .Only one question went wrong out of 72 questions.Thanks for this wonderful forum and the members coz of this i have got quick explanations to the doubts.The explantions here are simple and easy to understand.Keep up the good work.

Regards,
Sweety C
13 years ago
Sorry..Dint Look into the topic...Anyway thanks for moving it.Hope to get an quick reply.
13 years ago
Hi all,

import java.util.ArrayList;
import java.util.List;

class A1 {}
class B1 extends A1 {}
class C1 extends A1 {}
class D1 extends B1 {

List<?> l = new ArrayList<Object>();
List<? extends B1> m = new ArrayList<D1>();
#List<? extends A1> n = new ArrayList<? extends B1>();

}

In the above code the commented line gives compilation failure but it is expected to be successful.Can anyone help me out in this?

Thanks in advance,
Jesu
13 years ago
OOPs The mistake i was doing is i have not given the filname with extension.
The below code executes perfect.

import java.io.File;
public class Test {

public static void main(String... args) throws Exception {
File myDir = new File("test");
myDir.mkdir();
File myFile = new File("myDir","test1.txt");
myFile.createNewFile();
}

}
13 years ago
Thanks I got it

createNewFile() method creates an actual file.
13 years ago
I have modified my code like this

public class Test {

public static void main(String... args) throws Exception {
File myDir = new File("test");
myDir.mkdir();
File myFile = new File(myDir,"test1");
myFile.createNewFile();
}

}

Even now Cribbing
13 years ago
Hi all,

public class Test {

public static void main(String... args) throws Exception {
File myDir = new File("test");
// myDir.mkdir();
File myFile = new File(
myDir, "test.txt");
myFile.createNewFile();
}

}

What is the mistake i'm doing here?
It throws me the following exception :

Exception in thread "main" java.io.IOException: The system cannot find the path specified
at java.io.WinNTFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(Unknown Source)
at Files.Test.main(Test.java:11)

Thanks,
Jesu
13 years ago
Whenever you create an instance of a FileReader, a FileWriter, a PrintWriter, a FileInputStream, or a FileOutputStream classes, you automatically create a file, unless one already exists.


Anything else go ahead and add it .
13 years ago
Hi all,

What are the ways to create an actual file?

Please pour in your ideas.

Thanks in advance,
Jesu
13 years ago