Question: Question #13) (2 marks) When using the showinputDialog method of the JOptionPane class mention two things you should do to ensure the user enters at







Question #13) (2 marks) When using the showinputDialog method of the JOptionPane class mention two things you should do to ensure the user enters at least one character of text. Question #11) (3 marks) Assume a programmer is calling a method that throws an exception that needs to be caught. (a) Describe two different approaches the programmer can use to write his code so that the program will compile. (b) Why will a program compile even if it causes a null pointer exception? You may assume the programmer has not used one of your approaches from your answer in part (a). Question #12) (2 marks) What is a constructor and why is there no return type specified for a constructor? Question #16) (4 marks) (a) Explain why any class in Java can be declared as type Object even if it is instantiated as a class the programmer creates. (b) What restrictions apply to the methods called when the object is declared in the above way? (c) How could the programmer temporarily get around the restrictions in part (b) and what is a risk of using this approach? Question #14) (5 marks) Draw an appropriate UML diagram from the code below: public class Java Program extends OlderProgram { int type; Another Program variable; public double computeAverage(int[] values) { for(int i=0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
