Java File get file name

Description

Java File get file name

import java.io.File;

public class Main {
  public static void main(String[] args) {
    // Create a File object
    File myFile = new File("Main.java");

    System.out.println("File Name: " + myFile.getName());
  }/*from   w w w  . j a  v  a 2s .c  o  m*/
}



PreviousNext

Related