Java Basics Flashcards

1
Q

How do you write a traditional comment in Java?

A

By using “I + asterisk” to begin the comment and “Asterisk + /” to end the comment.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you write an end of line comment?

A

By using “//” at the end of your code
Example:
public static void main(String[] args) {
System.out.println(“I love Java”); //Replace “I” with “You”?
}
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you write a Javadoc comment?

A

By using “/**”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a javadoc comment?

A

A comment that is only seen when you run the javadoc program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does “double amountInAccount” do in the following code?
“public class Millionair {
public static void main(String[] args) {
double amountInAccount;”

A

It declares a variable that uses a certain range of numbers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How many bits can you store if you use a float variable declaration?

A

32-bits

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How many bits can you store if you use the double variable declaration?

A

64-bits

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does “Process finished with exit code 1” mean?

A

There is an error in your code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What will the following expression accomplish?

++varInt1;
–varInt2;

A

++varInt1 will increase the integer by 1. Called an increment.
–varInt2 will decrease the integer by 1. Called a decrement.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the following logical operator mean? “||”

A

”||” is the “or” logical operator.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do I make my string all upper case?

A

By using variable.toUpperCase()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

I want to trim the whitespaces off of my string. How can I accomplish this?

A

By using variable.trim()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How do I make my string all lower case?

A

By using variable.toLowerCase()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly