Community Sites
Create your own community website and start earning today !
It's Free !
Forum
Resources
Mentors
Projects
Entrance Exams
Question Papers
Colleges
Courses
Universities
Schools
Make Money
Communities
Members
Bookmarks
Polls
Fresher Jobs
Funny Pictures
MCA Projects
New Member FAQ
My Profile
Sign In
Register
AdSense Revenue
Active Members
Today
spot
(15)
bharath sudar
(10)
K Kalyan Chakr...
(10)
Last 7 Days
sunil
(2113)
satish
(1712)
Saagar
(1633)
more...
Awards & Gifts
Online Exams
Aptitude Questions
General Aptitude Tests
Medical Entrance
Engineering Entrance
Bank Tests
TOEFL & IELTS Questions
Fresher Jobs
Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian cities including Bangalore, Chennai, Hyderabad, Pune or Kochi
Resources
Find educational articles, blogs, discussion threads and other resources.
Colleges
Find details about any college in India or search for courses.
Java Program-Sort contents file
Posted Date: 18 Jun 2008 Resource Type:
Articles/Knowledge Sharing
Category:
Computer & Technology
Posted By:
Girish Patil
Member Level:
Diamond
Rating:
Points
: 3
import java.io.*;
public class sortfile
{
public static void main(String args[]) throws Exception
{
RandomAccessFile a;
a=new RandomAccessFile("a.txt","r");
int count=0;
String b;
while((b=a.readLine())!=null)
{
count++;
}
String[] p;
p=new String [count];
int i,j;
i=0;
a.seek(0);
while((b=a.readLine())!=null)
{
p[i]=b;
i++;
}
String temp;
for(i=0;i<=count-2;i++)
{
for(j=i+1;i<=count-1;j++)
{
if(p[j].compareTo(p[i])<0)
{
temp=p[i];
p[i]=p[j];
p[j]=temp;
}
}
}
PrintStream c;
c=new PrintStream("sorted.txt");
for(i=0;i
{
c.println(p[i]);
}
a.close();
c.close();
}
}
Responses
No responses found. Be the first to respond and make money from
revenue sharing program
.
Feedbacks
Popular Tags
What are tags ?
Search Tags
Sign In
Java Program
.
Post Feedback
This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must
Sign In
to post a response.
Next Resource:
Java Program-Copy file program
Previous Resource:
Java Program-Multithreading
Return to Discussion Resource Index
Post New Resource
Category:
Computer & Technology
Post resources and
earn money
!
Related Resources
Budget Palnner
simple trick to multiple login to yahoo messenger
SQL Server->Timestamp datatype
List of Software Testing Certifications!
increase your broadband speed
Watch TV Channels
Watch Asianet online
Kairali TV in Internet
Surya TV online
Amritha TV Channel
Contact Us
Editors
Privacy Policy
Terms Of Use
SpiderWorks Technologies Pvt Ltd. 2006 - 2007 All Rights Reserved.