ITCS 1213 Final Exam

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Which type of classes cannot be instantiated

abstract

A java interface contains only

abstract method headings and public final fields

When a class implements an interface it must provide what

all the methods that are listed in interface with exact signatures and return types specified

What are ragged arrays

arrays with different columns in each row

How man interfaces can another class implement

as many as needed

Which is subclass in the heading: Public class classA extends classB implements classC

classA

One or more statements that are always executed after the try block has executed and after any catch blocks if exception was thrown

finally block

This method is used to retrieve the error message from an Exception

getMessage())

What is the command to run a java program from command prompt

java fileName

What is the command to compile code from command prompt

javac fileName.java

What does Java assign each object in an array of objects

null

All classes directly or indirectly inherit from

object class

How many classes can a given class extend

one

What is two or more methods in the same class definition file having the same name but different signatures

overloading

What data type is a char

primitive

These superclass members are accessible only to the subclasses and class in the same package

protected

The following is an explicit call to the superclass's default constructor

super();

A checked Exception is checked by

the Java compiler

What is required for two methods to have the same signatures

the name of the methods and the data type of the parameters need to be the same

This informs the compiler of the Exceptions that could get thrown for a method

throws clause

What is meant by args?

An array of arguments

What does super do in this code? public class classB extends classA { Public classB() { Super(10) } }

It will call the constructor of ClassA that receives an integer as an argument

What will happen If a subclass constructor does not explicitly call a superclass constructor

Java will automatically call the superclass's default constructor just before the code in the subclass's constructor executes

All static class members must be declared with what access

Public

What is the access specifier for access to all methods

Public

What are two categories of errors in Java

Runtime (unchecked) Exceptions & Checked Exceptions

What line of code creates a Scanner object to read data from a file

Scanner input = new Scanner(new File("c:\\file.txt"));

T/F: A class may extend at most one superclass

True

T/F: A superclass constructor always executes before the subclass constructor

True

T/F: Every class has a toString method and an equal's method inherited from Object class

True

T/F: It is not possible for a superclass to call a subclass method

True

What is each element in a numerical array initialized to

0

In a subcass constructor, a call to the superclass constructor must

Appear as the very first statement

What is difference between a checked exception an unchecked

Checked exception must be either declared that it may occur or be caught in your code

What is meant by the error going up through the call stack

Error Propagation

This is the keyword that indicates a class inherits from another class

Extends

T/F: A class may implement at most one interface

False

T/F: A programmer can code only one thrown exception in a try block

False

T/F: All methods in an abstract class must also be declared abstract

False

T/F: If a method in a subclass has the same signature as a method in the superclass, the subclass method overloads the superclass method

False

T/F: Overloading methods and overriding methods are synonymous

False

T/F: If two methods in the same class have the same name but different signatures, the second overrides the first

False (overloading)

List the exceptions in the order they should be caught

FileNotFoundException, IOException, Exception

What kind of fields cannot be changed

Final

What block in exception-handling mechanism is optional?

Finally block

What line of code opens a file for output

PrintWriter outputFile = new PrintWriter("c:\\file.txt"));

A subclass does not have access to these superclass members

Private

Which access specifier give access of members to any subclass and classes in the same package only

Protected

In an inheritance relationship, this is the general class

Superclass

Any object that can be thrown as an Exception must inherit from this class

Throwable

What are two reasons for interfaces in Java

To implement a list of methods and organization


Kaugnay na mga set ng pag-aaral

Chapter 34: Care of the patient with a Psychiatric Disorder

View Set

Windows 10 70-697: Configuring Windows Devices

View Set

CE 499 Hazardous (and Universal) Waste Management

View Set