小编hit*_*j47的帖子

我应该将google-services.json(从Firebase)添加到我的存储库吗?

我刚刚注册了Firebase,并创建了一个新项目.Firebase问我的app域和SHA1调试密钥.我输入了这些详细信息,并生成了一个google-services.json文件供我添加到我的应用模块的根目录中.

我的问题是,这个.json文件是否应该添加到公共(开源)存储库中.它应该是秘密的东西,比如API密钥吗?

git version-control firebase

77
推荐指数
3
解决办法
2万
查看次数

循环时程序不会进入try块

我正在努力为学校写一个程序.分配是循环并要求用户输入文件.当找不到文件或者用户退出循环时(在我的情况下,他们点击joptionpane上的取消)输出每个文件的数据.到目前为止这是我的代码:

/**
 * @param args
 */
public static void main(String[] args) {

    // Lists to hold file data
    List<String> fileNames = new ArrayList<String>();
    List<Integer> numChars = new ArrayList<Integer>();
    List<Integer> numWords = new ArrayList<Integer>();
    List<Integer> numLines = new ArrayList<Integer>();
    String inFile;

    while ( (inFile = JOptionPane.showInputDialog("Enter a file name:")) != null) {

        // Create new file object instance
        File file = new File(inFile);

        try {
            fileNames.add(inFile);  // File name as a string
            // Pass file objects
            numChars.add( getNumChars(file));
            numWords.add( getNumWords(file));
            numLines.add( …
Run Code Online (Sandbox Code Playgroud)

java loops exception try-catch while-loop

1
推荐指数
1
解决办法
665
查看次数