Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Java throws keyword

import java.io.*;
class Main {
  // declareing the type of exception
  public static void findFile() throws IOException {
    // code that may generate IOException
    File newFile = new File("test.txt");
    FileInputStream stream = new FileInputStream(newFile);
  }

  public static void main(String[] args) {
    try {
      findFile();
    }
    catch (IOException e) {
      System.out.println(e);
    }
  }
}
Source by sites.google.com #
 
PREVIOUS NEXT
Tagged: #Java #throws #keyword
ADD COMMENT
Topic
Name
1+8 =