Scanner input = new Scanner(System.in); int waitTime; try{ System.out.println("Start of the try block"); System.out.prin

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Scanner input = new Scanner(System.in); int waitTime; try{ System.out.println("Start of the try block"); System.out.prin

Post by answerhappygod »

Scanner Input New Scanner System In Int Waittime Try System Out Println Start Of The Try Block System Out Prin 1
Scanner Input New Scanner System In Int Waittime Try System Out Println Start Of The Try Block System Out Prin 1 (153.72 KiB) Viewed 10 times
Scanner input = new Scanner(System.in); int waitTime; try{ System.out.println("Start of the try block"); System.out.println("Enter the time in sec. !!"); waitTime = input.nextInt(); if (waitTime > 30) { throw new Exception ("Time Limit Exceeded"); } System.out.println("End of try block"); } catch(Exception e) { System.out.println("Exception: "+e.getMessage()); } System.out.println("End of the program !!"); 21 } 22 } a) Guess the output of the above program if inputs are 31 and 30. Also, Justify your answer. 18 19 20 15 14 345 16 17 ▼ 10 11 12 ▼ 13 8 9 Upload answer sheets Consider the code below: 1 import java.util.Scanner; 2v class CatQuestion{ 3 public static void main(String[] args) 4▼ { 5 6 7▼
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply