Page 1 of 1

Q2 Answer Q2(a) - Q2(e) based on Java code segments in Figure Q2(a) and GUI in Figure Q2(b). (b) public class Age { (c)

Posted: Tue Jul 12, 2022 8:21 am
by answerhappygod
Q2 Answer Q2 A Q2 E Based On Java Code Segments In Figure Q2 A And Gui In Figure Q2 B B Public Class Age C 1
Q2 Answer Q2 A Q2 E Based On Java Code Segments In Figure Q2 A And Gui In Figure Q2 B B Public Class Age C 1 (49.63 KiB) Viewed 27 times
Q2 Answer Q2(a) - Q2(e) based on Java code segments in Figure Q2(a) and GUI in Figure Q2(b). (b) public class Age { (c) public static void main(String[] args) { int age; age= Integer.parseInt (JOptionPane.showInput Dialog ("How old are you?")); System.out.println("Your age is:" +age); Input ? Figure Q2(a) How old are you? twenty years old OK Cancel Figure Q2(b) (a) If the user enters the input as in Figure Q2(b) and click the OK button, what is the output of the program? Justify your answer. (6 marks) X Apply exception handling for the segment code in Figure Q2(a) by using try.. catch block and showMessageDialog (). (8 marks) With appropriate examples, discuss types of Java exceptions. (6 marks)