Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
    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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

meaning of return; only

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • 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
  • Report post to moderator
Please don't double post, and please see the name warning in your other thread.
 
That's my roommate. He's kinda weird, but he always pays his half of the rent. And he gave me this tiny ad:
ScroogeXHTML 8.7 - RTF to HTML5 and XHTML converter
https://coderanch.com/t/730700/ScroogeXHTML-RTF-HTML-XHTML-converter
    Bookmark Topic Watch Topic
  • New Topic