top of page

How Java Code 1 Works

  • Writer: Admin
    Admin
  • Jan 20, 2018
  • 1 min read

Updated: Mar 11, 2022


What Is Java Code Sample 1

class MyOwnException extends Exception { public MyOwnException(String msg){ super(msg); } } class EmployeeTest { static void employeeAge(int age) throws MyOwnException{ if(age < 0) throw new MyOwnException("Age can't be less than zero"); else System.out.println("Input is valid!!"); } public static void main(String[] args) { try { employeeAge(-2); } catch (MyOwnException e) { e.printStackTrace(); } } }

More Information:

Rev

 
 
 

Comments


Address

New Orleans, LA, USA

Contact

Follow

  • facebook
  • twitter
  • linkedin

7708661625

©2017 by Search Fast and Specific. Proudly created with Wix.com

bottom of page