Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 5 pages
Exam (elaborations)

Java Chapter 8 - Designing Classes Questions and Answers| Latest Update

Document preview thumbnail
Preview 2 out of 5 pages

Java Chapter 8 - Designing Classes Questions and Answers| Latest Update

Content preview

Java Chapter 8 - Designing Classes Questions
and Answers| Latest Update
Inside the class, but outside of any method body ✔️✔️Where in a class should static variables be
declared and initialized?



Before the code in the class constructor is executed ✔️✔️When are statements in a class-level
initialization block executed?



Once when the class is loaded ✔️✔️When are statements in a class-level static initialization block
executed?



If their scopes do not overlap ✔️✔️Under which conditions can you have local variables with
identical names?



The entire class in which the variable is defined ✔️✔️What is the scope of a private instance
variable?



To use a public variable or method outside of its class, you must ____ the name. ✔️✔️instantiate


The implementation of the methods will change, but the interface will not need to change
✔️✔️What will have to change if the instance variables month and day of the Date class are
replaced by the single instance integer variable dayOfTheYear?



No, unrelated classes should not be in one package ✔️✔️To make it easier to include a set of
frequently used but unrelated classes should you place them in a package?



the default package, which has no name ✔️✔️If you do not include a package statement at the
top of your class source file, its classes will be placed in which package?

, 1 2 ✔️✔️Consider the Checker class below.


public class Checker
{
public static int count = 0;
public int number = 0;


public Checker()
{
count++;
number = count;
}


public int getCount() { return count; }


public int getNumber() { return number; }
}
What is output from the code fragment below?


Checker one = new Checker();
Checker two = new Checker();
System.out.println(one.getNumber() + " " + two.getNumber());


The class that does not require an import statement at the beginning of the program that uses
it? ✔️✔️java.lang.Double

Document information

Uploaded on
March 21, 2025
Number of pages
5
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$8.49

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.
KateJones
4.8
(12)
Sold
31
Followers
0
Items
5707
Last sold
1 week 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