• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 3 out of 17 pages
Exam (elaborations)

C212 Evaluation 2026 Exams Questions And Answers Sure A.pdf

Document preview thumbnail
Preview 3 out of 17 pages

C212 EVALUATION 2026 EXAMS QUESTIONS AND ANSWERS SURE A.pdf

Content preview

C212 EVALUATION 2026 EXAMS QUESTIONS AND
ANSWERS SURE A+
✔✔Can you convert from an interface type to a class type? - ✔✔You need a cast to
convert from an interface type to a class type.

✔✔What is the design purpose of the Comparable interface? - ✔✔Implement the
Comparable interface so that objects of your class can be compared, for example, in a
sort method.

✔✔Can you compare floating point numbers by subtraction? How about integers? -
✔✔Floating point - No
Integers - Yes

✔✔Define: callback(s). - ✔✔A callback is a mechanism for specifying code that is
executed at a later (though clearly specified) time.

✔✔Define generic interface types. - ✔✔Let's use as an example the interface
Comparable. Comparable, like ArrayList, is a parameterized type. The type parameter
specifies
the type of the objects that this class is willing to accept for comparison.

,✔✔Define: inner class(es). Why would you use an inner class instead of a regular one?
- ✔✔A class that is declared inside another class is called an inner class. Inner classes
are commonly used for utility classes that should
not be visible elsewhere in the program.

✔✔Define: anonymous class(es). Why would you use an anonymous class instead of a
regular one? - ✔✔An entity is anonymous if it doesn't have a name. In Java, it is
possible to declare an anonymous class if all you ever need is a single
object of that class.

✔✔Define: event listeners. - ✔✔Event sources report on events. When an event occurs,
the event source notifies all event listeners. An event listener belongs
to a class that is provided by the application programmer. Its methods describe the
actions to be taken when an event occurs.

✔✔Describe a common, basic use for JPanel objects. - ✔✔Use a JPanel container to
group multiple user-interface components together.

✔✔Describe a common, basic use of the ActionListener interface. - ✔✔Specify button
click actions (or timer event actions) through classes that implement the ActionListener
interface.

✔✔Define: timer, timer events. - ✔✔Timer: class in java.swing that sets off a series of
events at even time intervals. Think of a timer event as an invisible button that is
automatically clicked.

✔✔Describe the meaning and use of a JComponent's repaint method. - ✔✔The repaint
method causes a component to repaint itself. Call repaint whenever you modify the
shapes that the paintComponent method draws.

✔✔Why does a timer require a listener object? - ✔✔The timer needs to call some
method whenever the time interval expires. It calls the actionPerformed method of the
listener object.

✔✔Define: mouse events. - ✔✔Implements the MouseListener interface. The 5 mouse
event methods are mouseEntered(), mouseExit(), mouseClicked(), mousePressed(),
mouseReleased()

✔✔Define: keyboard events. - ✔✔Implements the KeyListener interface. This has 3
methods keyPressed(), keyReleased(), keyTyped().

✔✔Explain: the Character class has methods for classifying characters. - ✔✔The
Character class declares several useful methods such as: isDigit, isLetter,
isUpperCase, isLowerCase, isWhiteSpace.

, ✔✔How do you convert Strings to numbers in Java? - ✔✔If a string contains the digits
of a number, you use Integer.parseInt(...) or Double.parseDouble(...) method to obtain
the number value.

✔✔Suppose the input contains the characters Hello, world! What are the values of
world and input after this code fragment

String word = in.next();
String input = in.nextLine();
next() gets the a word after a space, nextLine() gets the whole line. - ✔✔next() : Hello,
nextLine() : Hello, world!

✔✔Your input file contains a sequence of numbers, but sometimes a value is not
available and is marked as N/A. How can you read the numbers and skip over the
markers? - ✔✔Read them as strings, and convert those string to numbers that are not
equal to N/A:

String input = in.next();
if(!input.equals("N/A")){
double value = Double.parseDouble(input);
Process value;
}

✔✔Define: command line arguments. - ✔✔Programs that start from the command line
receive the command line arguments in the main method's String[] args.

✔✔Encrypt CAESAR using the Caesar cipher. - ✔✔DBFTBS
ECGUCT
FDHVDU

The answer is: FDHVDU and the sequence above shows how we get there.

✔✔When do you use the throw statement? - ✔✔To signal an exceptional condition use
the throw statement to throw an exception object. When you throw an
exception, processing continue in an exception handler.

✔✔What is the catch clause used for? - ✔✔When you throw an exception, processing
continue in an exception handler. Place the statements that can cause
an exception inside a try block and the handler inside a catch clause.

✔✔What are checked exceptions? - ✔✔Checked exceptions are due to external
circumstances that the programmer cannot prevent. The compiler checks that
your program handles these exceptions. A checked exception describes a problem that
can occur, no matter how careful

Document information

Uploaded on
July 14, 2026
Number of pages
17
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$16.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
BOARDWALKer
3.4
(19)
Sold
162
Followers
6
Items
26749
Last sold
17 hours ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions