Question : An unchecked exception occurs in a method dosomething() Should other code be added in the dosomething() method for it to compile and execute?
Correct Answer : Get Lastest Questions and Answer : Explanation: Because the Java programming language does not require methods to catch or to specify unchecked exceptions (RuntimeException, Error, and their subclasses), programmers may be tempted to write code that throws only unchecked exceptions or to make all their exception subclasses inherit from RuntimeException. Both of these shortcuts allow programmers to write code without bothering with compiler errors and without bothering to specify or to catch any exceptions. Although this may seem convenient to the programmer, it sidesteps the intent of the catch or specify requirement and can cause problems for others using your classes.
Question : Which two statements are true for a two-dimensional array of primitive data type? A. It cannot contain elements of different types. B. The length of each dimension must be the same. C. At the declaration time, the number of elements of the array in each dimension must be specified. D. All methods of the class object may be invoked on the two-dimensional array.
Question : A method is declared to take three arguments. A program calls this method and passes only two arguments. What is the result?
1. Compilation fails. 2. The third argument is given the value null. 3. Access Mostly Uused Products by 50000+ Subscribers 4. The third argument is given the value zero. 5. The third argument is given the appropriate false value for its declared type.
Correct Answer : Get Lastest Questions and Answer : Explanation: The problem is noticed at build/compile time. At build you would receive an error message like: required: int,int,int found: int,int