• 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 19 pages
Exam (elaborations)

Java Certification I Exam Questions & Answers 100% Correct!!

Document preview thumbnail
Preview 3 out of 19 pages

Package - ANSWERAll java classes are part of a package. 1) It must be the first statement in a class. 2) Classes and interfaces in the same package can use each other without prefixing their names with the package name. 3) To use a class or interface from another package must use a full, qualified name (unless imported). 4) Should be the first line of a class file unless preceded by a Comment 4) applies to all classes/interfaces in class file 5) lower case names 6) separated from subs by dot 7) one package statement per java source file 8) only comment can precede p. 16, 23, 31 Default package - ANSWER1) If a class does not start with the name of a package it is part of the unnamed "Default package". 2) Automatically imported in classes and interfaces in the same directory 3) A class from a default package can't be used in a named package class whether in same directory or not p. 16, 36 Import statement - ANSWER1) Use a class or interface in another package without the fully qualified name, p.16 2) Follows package statement and precedes class declaration 3) applies to all classes/interfaces in source file 4) cant use to access classes/interfaces of same name from different packages, e.g., .Date and .Date. 5) can import single class/interface or all. 6) use asterisk to import all public members, classes, interfaces 7) asterisk doesn't recursively import classes from subpackage

Content preview

Java Certification I Exam Questions & Answers
100% Correct!!

Package - ANSWERAll java classes are part of a package. 1) It must be the first statement in a class. 2)
Classes and interfaces in the same package can use each other without prefixing their names with
the package name. 3) To use a class or interface from another package must use a full, qualified
name (unless imported). 4) Should be the first line of a class file unless preceded by a Comment

4) applies to all classes/interfaces in class file

5) lower case names

6) separated from subs by dot

7) one package statement per java source file

8) only comment can precede

p. 16, 23, 31



Default package - ANSWER1) If a class does not start with the name of a package it is part of the
unnamed "Default package".

2) Automatically imported in classes and interfaces in the same directory

3) A class from a default package can't be used in a named package class whether in same directory
or not

p. 16, 36



Import statement - ANSWER1) Use a class or interface in another package without the fully qualified
name, p.16

2) Follows package statement and precedes class declaration

3) applies to all classes/interfaces in source file

4) cant use to access classes/interfaces of same name from different packages, e.g., java.util.Date
and java.sql.Date.

5) can import single class/interface or all.

6) use asterisk to import all public members, classes, interfaces

7) asterisk doesn't recursively import classes from subpackage



package university;

,import certification.ExamQuestion;

class AnnualExam {

ExamQuestion eq;

}

p. 34-36



Compile Failures - Package statement - ANSWER1) Package statement at end of class definition; 2)
package statement within class definition; 3) multiple package statements for class

p. 16



Compile Failures - Import statement - ANSWER1) Import statement appears before package
statement.

p.17



Comment Location - ANSWERCan appear anywhere in code, including: 1) before package statement;
2) after package statement; 3) before class definition; 4) after class definition; 5) before method
definition; 6) after method definition; 7) within method definition

p. 17



Comment Types - ANSWERSingle line and multi-line

p. 17



Comment - Multi-line - ANSWERBegin: /*

End: */

Notice asterisk in the middle and forward slash on outsides

p. 17



Comment - End-of-line - ANSWERStart with //

p. 18



Class declaration - simple - ANSWERMost simple is keyword "class" followed by class name.

p. 19

, Class declaration - components - ANSWER1) Access modifiers - optional

2) Non-access modifiers - optional

3) "class" keyword – compulsory

native [method] - ANSWER1) Non-access modifier

2) Uses libraries and methods implemented in other program languages, e.g., C++

3) Cannot use with classes, interfaces, variables

p. 48



transient [variable] - ANSWER1) Non-access modifier

2) Is not serialized when corresponding object is serialized

3) Cannot use with classes, interfaces, methods

p. 48



volatile [variable] - ANSWER1) Non-access modifier

2) Value can be safely modified by different threads

3) Cannot use with classes, interfaces, methods

p. 48



strictfp [class, interface, method] - ANSWER1) Non-access modifier

2) Ensure calculations using floating-point number are identical across platforms

3) Can use with classes, interfaces, methods

4) Cannot use with variables

p. 48



Abstract modifier - ANSWER1) Non-access modifier

2) Can use with classes, interfaces, methods

3) Cannot use with variables

p. 48



Abstract class - ANSWER1) Class that cannot be instantiated

Document information

Uploaded on
August 2, 2024
Number of pages
19
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$14.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.
papersmaster01
3.9
(74)
Sold
310
Followers
106
Items
14763
Last sold
2 days 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