Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Find the size of the File in Java program
WhatsApp
Alagunila Meganathan
Aug 02
2016
443
0
0
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
Up Next
Find the size of the File in Java program