import java.util.*; class Lab26 { public static void main(String args[]) { Scanner x=new Scanner(System.in); System.out.print("enter size="); int size=x.nextInt(); try { int a[]=new int[size]; } catch(Exception e) { System.out.println(e); System.out.println("array size is negative"); System.exit(0); } finally { System.out.println("array size is positive"); } } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter