Q. Which of these is a correct way to create a File object?

A
File f = new File('path');
B
File f = new File('path');
C
File f = File.create('path');
D
File f = new File(path, name);
Solution:

The correct syntax uses double quotes: File f = new File(‘path’); for a file path.

Entri Contact Image

Get Expert Advice for Free: Register for Your Free Consultation Now!