• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/65

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

65 Cards in this Set

  • Front
  • Back
  • 3rd side (hint)
What are packages?
Packages are containers for classes. They define where .classes will be located in the hierarchical directory structure.
What are the advantages of placing classes in a package?
Decreases classes colliding, helps enable code reuse, maintainability, and the follows the guidelines of encapsulation and modulation.
What is code collision?
Having multiple files .java or .class with the same name in the same directory.
Example having two plane.java in the same directory.
Advantage(s) of Package's Attribute of Class Coupling?
Package dependencies are reduced
Advantage(s) of Package's Attributes of System Coupling
Package dependencies are reduced with system coupling
Advantage(s) of a Package's attributes of package size?
Typically, larger packages support reusability, smaller packages support maintainability.
Advantage(s) of a Package's attributes regarding maintainability?
Often, software changes can be limited to a single package when the package houses focused functionality
Advantage(s) of a Package's attribute regarding naming?
consider conventions when naming your packages. Use revers domain name for the package structure. Use lowercase characters delimited with underscores to separate words in package
Where must the package statement be in the file?
It must be the very first line of code at the top of the file.
How many packages statements can be in a source file?
At most 1 but it can have 0.
What key word to you to include access to other classes in your source file?
import
What is the standard coding convention for package names?
Reverse name of the domain name organization. Example. Organization scjaexam.com package name com.sjcaexam.utilities
What do package names represent?
It represents the file structure in which the .class files are found. Example com.scjaexam.utilities represents the directory: com/scjaexam.utilities/*.class
Which words that begin a package are reserverd?
java.* and javax.*
Are package names normally upper or lowercase?
lowercase
What are some common packages from the Java SE 6 API will typically be on the exam?
Java Abstract Window Toolkit (java.awt.*), Java Swing, Java Basic Input/Output (java.io.*), Java Networking, Java Utilities (java.util.*), Java Language (java.lang.*)
Which package would you use to paint basic graphics and images?
Abstract Window Toolkit (java.awt.*)
Which package would you use to create lightweight components for GUI?
Java Swing (javax.swing.*)
Which package would you use to utilize data streams?
Java Input/Output (java.io.*)
Which package would you use to develop networking applications?
Java Networking
which package would you use to work with the collections framework, event model, and data/time facilities?
Java Utilities (java.util.*)
Which package would you use to utilize the core java classes and interfaces?
Java Language (java.lang,*)
What does this statement import, import java.net.*?
Import all classes from the package java.net
What does the import statement do, java.net.URL; ?
Import only the URL class from the java.net package.
What does this import statement do, import static java.awt.Color.*;?
Imports all the static members of the Color class of the package java.awt.
Is it better to explicitly import the classes you need or use the .* and why?
It is better to explicitly state the classes because it allows other programmers to know which classes are being used throughout the class. Example import java.util.Vector is better than java.util.*.
What are the 5 packages you need to know about for the SCJA exam?
java.util, java.io, java.net, java.awt, java.lang
What are the 4 main categories that are found in the java.util package?
Java collection framework, date and time, internationalization, and miscellaneous
What help does the Collections API help the Comparator interface?
It helps sort collections where unnatural ordering occurs.
What does the Comparable interface reside and what does it do?
It resides in the java.lang package and helps in the sorting object by their natural ordering.
What are 4 interfaces that you can find in java.util regarding Collections?
List, Map, Set, Queue
what are 3 classes that implement the List Interface and what is unique about these types of data structures?
ArrayList, LinkedList, Vector. These data structures are based on positional access.
What are 4 classes that implement the Map interface and what is unique about their data structure?
HashMap, HashTable, LinkHashMap, TreeMap. These data structures map keys to values
What are 3 classes that implement the Set interface and what is unique about their data structure?
HashSet, LinkedHashset, and TreeSet. These data structures are based on element uniqueness.
What is a class that implements the Queue interface and what is unique about its data structure?
PriorityQueue. Queues are typically first in first out (FIFO). PriorityQueues order elements according to a supplied comprator.
What Classes are used to represent Data and time capabilites in java.util
Date, Calendar, and TimeZones
What class in java.util is used to represent internationalization?
Locale
What are 4 other miscellaneous classes in java.util
currency, Random, StringTokenizer(means for breaking down strings into tokens), Timer(provides a task scheduling facility).
What is java.io used for?
It is used for general system input and output regarding data streams, serialization, and the file system.
What are the 2 major class hierarchies in java.io?
Reader and writer.

Reader has the subclasses (BufferedReader, InputStreamReader, and FilterReader) that inherent the Reader class. FileReader inherents from the InputStremReader.


The Writer class has 3 subclasses (BufferedWriter, OutputStreamWriter, FilterWriter) that inherent from the Writer class. The FileWriter inherents from the OutputStreamWriter class
What are 4 classes in the java.net package and what do they do?
Socket (Provides for the implementation of client sockets), ServerSocket (Provides for the implementation of server sockets), URL (Represents a uniform resource locator), and Inet4Address(Represents an internet Protocol version 4 (IPv4) address).
What is the java.awt used for?
It is used to create HEAVYWEIGHT components in regards to creating user interfaces and painting associated graphics and images.
What is preferred today for GUI applications java.awt or javax.swing?
javax.swing
What is one part of the java.awt that is still favored over javax.swing?
AWT focus subsytem. It provides navigation control between components.
What does javax.swing used for?
It provides functionality for creating lightweight (pure-java) containers and components.
How did they change the name of the javax.swing classes in order to distinguish it from the obsolete java.awt classes?
They added a J to the beginning of the classes names. JLabel, JPanel...etc
What design pattern does the javax.swing take advantage of and how?
The MVC (model-view-controller). The model represents the state of each component. The view represents the components on the screen. The controller is the functionality that ties the UI components to the event.
What does the x in javax stand for?
It stands for packages comprised of Java standard extensions.
Where do you find the java compiler tool in the JDK along with other tools?
In the bin directory.
What does the java compiler, javac, do?
It converts your source code, .java files, into bytecode and stores the bytecode as .class files
what is the general pattern for using the javac command?
javac [options] [source files]. Example.

javac -d . com/*.java (means to compile all the java files in the com directory and then output the class files into a directory hierarchy describe by the package statement. Those creation of the top of the hierarchical structure directory should start at the current location.
javac is actually what type of file?
It is an executable file .exe on windows the javac.exe file extension is optional for the command and it doesn't exist on Unix-like systems
what option do you use to explicity specify where you would like the compiled bytecode .class files to go?
-d

example:

javac -d classes Hello.java would store the Hello.class file in the classes/ directory, which would look like this.
classes/Hello.java
If the Hello.java had a package statement,
package com.sjcaexam.tutorial and the code was compiled using the javac -d classes Hello.java command, where would I find Hello.class bytecode?
[present working directory]\classes\com\scjaexam\tutorial\Hello.class
If you used the command:

javac -d classes Hello.java,

does the classes directory need to already exist for the command to execute?
Yes!
What option do you use in the javac command if you your source code had user-defined classes and packages and JVM might need to know where to find them?
-classpath option or -cp (same thing)
what does this command do?

javac -d classes -cp 3rdPartyCode\classes\;. Hello.java
The compiler includes in its compilation any source files that are located 3rdPartyCode\classes as well as the current directory (.) It will output the bytecode to classes directory.
what do you do to delimit different classpaths you need to use in the javac command.
the semicolon ; separates different classpaths you need in windows

javac -cp com\practice; com\tutorial;.

On a POSIX system a colons

javac -cp com/practice:com/tutorial:.
What is the path from source code to application?
SourceCode.java -> (Compiler) javac -> SourceCode.class -> (Intrepter) java -> SourceCode application
what does the java interpreter do?
It takes bytecode .class files and turns it into machine code appropriated for the platform it is running on.
What is the basic java interpreter command structure?
java [-options] clas [args...]

example java -cp classes com.scjaexam.tutorial.Hello Bob

This means interpret the class file that is stored in the hierarchical structure com/scjaexam/tutorial/Hello.class. Look for this classpath hierachy in the classes directory, if you classes directory is located in the current directory.

The application Hello takes an argument. We are going to supply it with the String Bob for its argument.
what does javaw do?
It is an option you can use on Microsoft Windows to exclude the command window when running the program which is nice for GUI-based applications.

javaw.exe MainClass
what does java MainClass & do?
It runs the MainClass application in the background.
What command do you use to interpret your Bytecode?
-D option allows for setting of new property values. The usage is as follows:

java -D<name>=<value> class
what option do you use to find out which java you are using and what are some valid and invalid placement of that option.
answer -version
typical command, java -version.
will work:
java -version INVALID_ARGUMENT


java HelloWorld -version will start the appliaction HelloWorld but not the version