This program will print the exact (absolute) path of the file and file length i.e. file size in bytes, to get the file path we will use the File.getAbsolutePath() method and to get file length (size) we will use File.length() Method.
File.getAbsolutePath() - Method return absolute path of the file, this is the method of File class.
File.length() - Method returns the file size (length) in the bytes, this is also method of File class.
Get File Length (Size) and File Path in Java
Output: