stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
Java Programming Chapter 2 Flashcards | StudBud
Explore
/
Java Programming Chapter 2
Java Programming Chapter 2
20 terms
·
StudBud Administration
·
288 plays
Basics of Java Programming
Flashcards
20 cards
F
Practice quiz
P
Host live
L
Questions
20
Answers
1
After you have built “Antler.class”, which command line statement will run the program?
java Antler.class
java Antler
javac Antler
javadoc Antler.class
2
How would you write a single-line comment with the text "is it Friday yet"
// is it Friday yet
<!--is it Friday yet-->
"is it Friday yet"
/*is it Friday yet
3
Why would you want to add comments to a program?
Neither are correct
Both are correct
Describe the author of a program and the program’s purpose
So another programmer can better understand your code
4
What file extension will your Java source files have?
.java
.exe
.source
.class
5
How many independent Java classes can you put within one source file?
0
1
∞
3
6
If the name of the class in your source code is “Nbapro”, what must the *.java filename be?
Nbapro.java
Class_Nbapro.java
Anything; filenames do not have to match the class names
Nbapro_Class.java
7
Which code example below is not valid?
int myValue; myValue = 1; System.out.println( myValue);
int myValue; myValue = 1; System.out.println(myValue);
int myValue; myValue = 1; System.out.println(myValue);
They are all equally valid and do the same thing.
8
What are some possible causes of compile-time syntax errors reported by javac?
missing semi-colons
spelling errors
missing curly braces
all of these are true
9
If your top-level source directory is ROOT, where must the object "my.utilities.It" be located?
ROOT\It.java
ROOT\my\utilities\It.java
You can place source files wherever you like.
ROOT\my.utilities\It.class
10
How do you start and end a multi-line comment?
Start with */ and end with /*
Start with /* and end with */
Start with // and end with //
Start with " and end with "
11
When was the first version of Java released?
1990s
1980s
2000s
1970s
12
Which of the following best describes the JRE?
Oracle Corporation’s brand name for Java sold at a profit
Something that runs in your web browser to enable animations
The development environment where you type your source code
A combination of the JVM and the Java Class Libraries
13
Where would you store “Water.java” if it was part of the “r.a.i.n” package?
r\a\i\n\Water.java
Store Water.java in the root of your project directory
You can store your .java files anywhere you like
n\i\a\r\Water.java
14
Which of the following components is included in the JDK and not the JRE?
“javadoc”, which makes HTML documentation from comments
All of these are included in the JDK and not the JRE
“javac”, the compiler that turns source code into bytecode
“jar”, which bundles Java .class files into a single package
15
What keyword identifies a group of statements and data that work together as a unit?
main
class
package
static
16
What is the impact of white-space on the compiler?
none; the compiler ignores white-space
white-space is not allowed
white-space can be used to fix errors
white-space can be used to terminate statements
17
What command will turn the YourCode.java file into YourCode.class?
java YourCode.java
javadoc YourCode.java
javac YourCode.java
java YourCode
18
Why might you get a "file not found" error when running "javac HelloWorld.java"?
Both of these are true
Your command line is not on the directory you thought it was
HelloWorld.java does not exist in the current directory
Neither is true
19
Which function declaration below best describes the entry point of your program?
public static void main(String[] args)
static int main(String args)
void enter(String[] args)
public static void main()
20
How would you declare a package containing “coke” and “soda”, where “soda” is the most general?
package coke_soda;
package coke.soda;
package soda.coke;
import soda.coke;