Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

meaning of return; only

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
hi friends
help me
if i remove return statement from catch block it shows
fin valriable might not have been initialised.
otherwise compile easy.
also tell me what is the meaning of return , actually what it is doing there
help me friends



import java.io.*;

class ShowFile
{
public static void main(String args[]) throws IOException
{
int i;
FileInputStream fin;
String ss=args[0];

try
{
System.out.println("pravin");
fin=new FileInputStream(ss);
System.out.println("pravin2");

}

catch(FileNotFoundException e)
{
System.out.println("File Not Found");
return;
}
catch(ArrayIndexOutOfBoundsException e)
{
System.out.println("Usage: ShowFile file");
return;
}


do
{
System.out.println("pravin2");
i=fin.read();
if(i!=-1)
System.out.print((char)i);
}
while(i!=-1);
fin.close();


}

}
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please don't double post, and please see the name warning in your other thread.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic