TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Find the size of the File in Java program
Alagunila Meganathan
Aug 02
2016
Code
427
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
ReadInByteArray.rar
import
java.io.*;
public
class
ReadInByteArray {
public
static
void
main(String[] args) {
try
{
File file =
new
File(
"tapan.txt"
);
int
size = (
int
)file.length();
//It gives the length of the file.
System.out.println(
"Size of the file: "
+ size);
}
catch
(Exception e){
System.out.println(
"Exception has been thrown :"
+ e);
}
}
}
Java
File