I have a code that calls a method, but after this call, any code after it is not executed....here is the method call skeleton
if(//some condition){
//some code
myMethod(//some variables);
//some code/*not executed*/
}
the calling is done well but the code stays in that method i.e code following the method call is not executed. I dont know if this maybe due to the method being called because there method does not return anything. below is a skeleton of the method
public void myMethod(//some variables)
{
//some code here, basically initializing buffer streams
try
{
//a new file output stream is created here
}
catch(IOException e ){
}
//some jpeg encoding code
try
{
// jpeg encoder and closing the file stream
}
catch (IOException e){
}
}
I hope this can put my point across. Any help is highly appreciated
You could have an infinite loop. You could never return from your function. You could have some uncaught exception that is crashing the program. You need to put in some debugging to see how far you make it. Breakpoints would be better, but since I can't put them here, I'll use System.out.println statements. See how far you get by what displays. Again, breakpoints are much faster, with nothing to remember to delete.
public void myMethod(//some variables)
{
//some code here, basically initializing buffer streams
System.out.println ("Before first try");
try
{
//a new file output stream is created here
System.out.println ("In first try");
}
catch(IOException e ){
System.out.println ("In first catch");
}
//some jpeg encoding code
System.out.println ("Between first and second try/catch");
try
{
// jpeg encoder and closing the file stream
System.out.println ("In second try");
}
catch (IOException e){
System.out.println ("In second catch");
}
System.out.println ("Made it to end of myMethod");
}
Reputation Points: 2614
Solved Threads: 687
Posting Expert
Offline 5,372 posts
since Jan 2008