Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

example of throws clause in method

import java.io.*;
class ThrowExample { 
  void myMethod(int num)throws IOException, ClassNotFoundException{ 
     if(num==1)
        throw new IOException("IOException Occurred");
     else
        throw new ClassNotFoundException("ClassNotFoundException");
  } 
} 

public class Example1{ 
  public static void main(String args[]){ 
   try{ 
     ThrowExample obj=new ThrowExample(); 
     obj.myMethod(1); 
   }catch(Exception ex){
     System.out.println(ex);
    } 
  }
}
Comment

PREVIOUS NEXT
Code Example
Java :: system program j 
Java :: generate infinity steam java 
Java :: how to get map with string as key and Arraylist as value in java 
Java :: setCookie("showPopupBannerBeta", 1, 1 
Java :: Java Numbers and Strings 
Java :: illegal expression 
Java :: check if item lore is something bukkit 
Java :: Double matrix 
Java :: How to adjust layout when soft keyboard appears 
Java :: rgb code from java color 
Java :: exemple javafx 
Java :: problem solving using recursion in java 
Java :: android studio remove navigation bar 
Java :: can you override static methods in java 
Java :: arraylist add method 
Java :: java check if class is subclass 
Java :: print treeset java 
Java :: casting in java 
Java :: add integers java 
Java :: Spring boot init method 
Java :: Access HashMap Elements 
Java :: local inner class in java 
Java :: partioning operation Java 
Sql :: conda install sqlalchemy 
Sql :: sql find text in sp 
Sql :: update sql server from another table 
Sql :: pl sql output 
Sql :: mysql return 0 if null 
Sql :: how to list columns for particular tables in postgresql 
Sql :: installer postgresql sur ubuntu 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =