Datasets:

ArXiv:
License:
File size: 343 Bytes
c574d3a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package exceptionexample3;

/**
 *
 * @author DeLL
 */
public class CheckNum  {

   public void checknumber(int a)throws NegativeNumberException{
   if(a>=0){
    System.out.println("The number you have entered is valid");
  }
   else{
    String msg="Please enter the positive number!";
    throw new NegativeNumberException(msg);
   }
 }

}