package com.mindprod.example;
import java.io.File;
import java.io.IOException;
import static java.lang.System.*;
/**
* Explore how File.getParent works.
*
* @author Roedy Green, Canadian Mind Products
* @version 1.0 2016-08-23 initial version
* @since 2010-02-20
*/
public final class TestParent
{
/**
* Explore how File.getParent works.
*
* @param args not used
*/
public static void main( String[] args ) throws IOException
{
final File plain = new File( "temp.txt" );
out.println( plain.exists() ? "exists" : "missing" );
out.println( plain.getParent() );
final File qualifiedDir = new File( "C:\\Users\\Public\\" );
out.println( qualifiedDir.getParent() );
final File qualifiedFile = new File( "C:\\Windows\\System32\\drivers\\etc\\hosts." );
out.println( qualifiedFile.getParent() );
final File noDriveFile = new File( "\\Windows\\System32\\drivers\\etc\\hosts." );
out.println( noDriveFile.getParent() );
final File slashFile = new File( "C:/Windows/System32/drivers/etc/hosts." );
out.println( slashFile.getParent() );
}
}