MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

/*
 * Output: 
getCanonicalPath() = C:\winnt
 */

import java.io.File;

public class MainClass {

    public static void main(String args[]) {

        try {

            File file = new File("c:\\winnt");
            System.out.println("getCanonicalPath() = " + file.getCanonicalPath());

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}