Here is the above code which was (submitted in C++) in Java.

FileManager.java

public class FileManager {
 
   private static FileManager instance = null;

   public static FileManager getInstance() {

        if ( instance == null ) { 

            instance = new FileManager();

        }

        return instance;
    }

}

Main.java

public class Main {


    public static void main( String args ) {

        FileManager instance = FileManager.getInstance();

    }

}