Java Programming Flashcards
What is a module?
A group of related packages
What is a package?
A group of related types, classes, interfaces or subpackages.
Which package contains the Scanner class?
java.util
What is a prerequisite for using a class? Why?
- The package it is contained within must be imported
- It informs the compiler where it is located.
What sections are included in API documentation for a class? What is the purpose of each?
- Class overview: Describes the class’ functionality and how it is commonly used in a program.
- Constructor summary: Provides a list and brief description of constructors that can be used to create objects of the class.
- Method summary: Provides a list and brief description of all methods that can be called on an object of the class.
- Constructor and method details: A detailed description of all constructors and methods for the class.
True or False: API documentation only includes information about public methods.
True
What type of object is System.in?
InputStream
When is an InputStream object created?
When the java program is executed
What is the appropriate constructor for Scanner(System.in)?
Scanner(InputStream source)
What does documentation provide for each method of a class?
- Method declaration
- Description of the method
- List of parameters, if any
- Description of the methods return value
- List of possible exceptions the method may throw
What is the javadoc tool used for?
Parses specially formatted multi-line comments to generate program documentation in HTML format
What is the syntax for creating a javadoc comment?
/** Your comment here */
What is the syntax for a block tag?
@keyword
At a bare minimum, each method should contain the following information as a javadoc comment.
- Description
- @param block tag
- @return block tag
What does the @see block tag describe?
Relevant information like a website or another method.
Which block tag specifies the author?
@author
Which block tag specifies the version number?
@version
True or false: When a javadoc comment is updated, the HTML documentation is automatically updated.
False: The javadoc tool must be run.
What are the types, classes, and interfaces in a package called?
Package members
Which package is automatically imported by Java?
java.lang
What elements make up a members fully qualified name?
the package name.the member name
What are 3 ways a programmer can use a package member?
- Fully qualified name
- Use an import statement to import the package member.
- Use an import statement to import the entire package.
What is the syntax for importing an entire package?
import packageName.*
Which class serves as the base class for all other classes?
Object
@param for each parameter */