Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    /**
     * Read a file and return as a String
     *
     * @param path      the filepath to append the extension to
     * @param extension the extension to be appended
     * @return the string representing the filename with extension
     * @since 0.11.0
     */
    public static String addExtension(String path, String extension) {
        if (path == null || path.isEmpty()) {
            return "";
        }

        if (extension == null || extension.isEmpty()) {
            return path;
        }

        return path + "." + extension;
    }
}