Boostr



0 votes
13 views
import java.io.IOException;

import java.io.InputStream;

import java.util.Properties;

public class FileHelper {

  public String getFilePathToSave() {

Properties prop = new Properties();

String filePath = "";

try {

 InputStream inputStream =

   getClass().getClassLoader().getResourceAsStream("config.properties");

 prop.load(inputStream);

 filePath = prop.getProperty("json.filepath");

        } catch (IOException e) {

e.printStackTrace();

}

return filePath;

  }

}

Run it.

FileHelper helper = new FileHelper();

String filePath = helper.getFilePathToSave();
asked Sep 11 in Java Interview Questions by Amrendra | 13 views



Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

Related Questions



Welcome to Knowledge Boostr, where you can ask questions and receive answers from other members of the community.
This is a collaboratively edited question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

http://boostr.in Q&A for professional and enthusiast programmers http://boostr.in Q&A for professional and enthusiast programmers http://boostr.in Q&A for professional and enthusiast programmers http://boostr.in Q&A for professional and enthusiast programmers


23,471 questions
40,135 answers
12 comments
23,609 users