Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.File;

public class Main {
    /**
     * Joins path elements using the systems path separator. e.g. "/tmp" and
     * "test.wav" combined together should yield /tmp/test.wav on UNIX.
     * 
     * @param path
     *            The path parts part.
     * @return Each element from path joined by the systems path separator.
     */
    public static String combine(final String... path) {
        File file = new File(path[0]);
        for (int i = 1; i < path.length; i++) {
            file = new File(file, path[i]);
        }
        return file.getPath();
    }
}