Java create a file/directory

Creating a file or directory in Java is very simple. You can specificity the file/directory path and then invoke mkdir() and createNewFile() methods. The following code example shows how to create a file and a directory.

public class Maker {
    public static void main(String[] args){
            File dir = new File("dir3");
            File file = new File(dir,"file3");
        }catch(Exception x){
Category >> Basics  
If you want someone to read your code, please put the code inside <pre><code> and </code></pre> tags. For example:
String foo = "bar";