Java Basics Flashcards
How do you write a traditional comment in Java?
By using “I + asterisk” to begin the comment and “Asterisk + /” to end the comment.
How do you write an end of line comment?
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 do you write a Javadoc comment?
By using “/**”
What is a javadoc comment?
A comment that is only seen when you run the javadoc program.
What does “double amountInAccount” do in the following code?
“public class Millionair {
public static void main(String[] args) {
double amountInAccount;”
It declares a variable that uses a certain range of numbers.
How many bits can you store if you use a float variable declaration?
32-bits
How many bits can you store if you use the double variable declaration?
64-bits
What does “Process finished with exit code 1” mean?
There is an error in your code.
What will the following expression accomplish?
++varInt1;
–varInt2;
++varInt1 will increase the integer by 1. Called an increment.
–varInt2 will decrease the integer by 1. Called a decrement.
What is the following logical operator mean? “||”
”||” is the “or” logical operator.
How do I make my string all upper case?
By using variable.toUpperCase()
I want to trim the whitespaces off of my string. How can I accomplish this?
By using variable.trim()
How do I make my string all lower case?
By using variable.toLowerCase()