How does the keyword "super" work, when called from a constructor?
<pre><code>import java.io.*;

class MyException1
{
static String str="";

 public static void main(String args[])
 {
 BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
 System.out.println("Enter your food");


 try{
 str=br.readLine();
 }catch(IOException e){
 System.out.println("Exception has been occurred"+e);
 }


 try{
 checkFood();
 }catch(BadException be){
 System.out.println("Exception"+be);
 }
 }


 private static void checkFood() throws BadException
 {

 if(str.equals("Rotten")|| str.equals("")){
 System.out.println("Bad food");
 //throw new BadException();
 throw new BadException("Not Eatable");
 }else{
 System.out.println("Good food !! enjoy");

 }
 }
}



class BadException extends Exception
{
String food;

 BadException()
 {
 super(); 
 food="invalid";
 System.out.println(food);
 }

 BadException(String s)
 {
 super(s); 
 food=s;
 }

 public String getError()
 {
 return food;
 }

}
</code></pre>

<p>In the program, how is it that this <code>public String getError()</code> returns the <code>food</code> variable?  I have not called it anywhere?</p>

<p>If I remove the line <code>super(s);</code>, then "Not Eatable" does not get printed.  But if I leave that line in, then it does get printed out.  How does this program flow work?</p>
