By Rishab Narang
Problem Statement: Using RandomAccessFiles in java, write the paragraph into a file. Convert the paragraph into titlecase. 

For eg: this is a sample titlecase program. 
Your output should be: This Is A Sample Titlecase Program.

The obtained output should be stored into another file (you can even overwrite the same file).

Assumption: Consider words separated only by spaces..
Here's a sample code of the above problem. But this program doesn't print the first value of the line that you enter...try to solve this problem.
import java.io.*;
import java.util.*;
class toupper
{
public static void main(String []args)
{
boolean flag=true;
try
{
RandomAccessFile ref=new RandomAccessFile("toupper.txt","rw");

String s;

Scanner sc=new Scanner(System.in);

while(flag)
{
s=sc.nextLine();
if(s.equals("stop"))
break;
else
ref.writeUTF(s);
}
ref.close();
}catch(IOException i)
{
flag=false;
}

try
{
RandomAccessFile ref1=new RandomAccessFile("toupper.txt","rw");
String s1;
String s2=" ";

while((s1=ref1.readLine())!=null)
{
s2=s1;
}
String []s3=s2.split(" ");


String s4[]=new String[s3.length];
int m=0;

for(int j=0;j<s3.length;j++)
{
int i=0;
char ch=s3[j].charAt(i); 
if(Character.isLetter(ch))  //This won't take print the first word.
{
char c=Character.toUpperCase(ch); 
s4[m]=c+s3[j].substring(1,s3[j].length());
m++;
}


}
RandomAccessFile ref2=new RandomAccessFile("touppercase.txt","rw");
for(int j=0;j<s4.length;j++)  //storing the updated titlecase paragraph in the new file called 'touppercase.txt'
{
if(s4[j]!=null)
{
System.out.println(s4[j]);
ref2.writeChars(s4[j]);
}
else
break;
}
ref2.close();

ref1.setLength(0);
ref1.close();

}catch(IOException i)
{
}
}
}
Sample Output: The first word isn't printed..Read the above code and solve this issue! Challenge your programming skills now!