Henry E.

asked • 10/12/20

Create two files using any word – processing program or text editor. Write an application that determines whether the two files are located in the same folder. Save the files as SameFolder.java

Can anyone please finish this I have a hard time doing it

PLEASE

package samefolder;

import java.util.*;

import java.text.*;

import java.io.*;

import java.io.File;


public class SameFolder {

private static Object f;

public static void main(String[] args)

{


final Formatter sup;


try

{

File file = new File("C:\\Users\\saint\\Desktop");

File f = new File("C:\\Users\\saint\\Desktop");

if(!file.exists() && !f.exists())

{

file.createNewFile();

f.createNewFile();

}

sup = new Formatter("FileStatistics.java");

System.out.println("File created ^-^!");

System.out.println("Folder created! ^-^");

}

catch (IOException e)

{

System.out.println("IO Exception");

System.out.println("File not created! ;^;");

System.out.println("Folder not created! -_-*");

}


}

}

The output should determine whether the two files are located in the same folder

1 Expert Answer

By:

Patrick B. answered • 10/12/20

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.