True or False Flashcards
Non-primitive data types can be used to call methods to perform operations, while primitive data types cannot.
True
A primitive data type always has a value, while the value of non-primitive data type can be null.
True
A primitive data type starts with a uppercase letter, while non-primitive data type starts with a lowercase letter.
False
A primitive data type starts with a lowercase letter, while non-primitive data type starts with an uppercase letter.
When we assign reference values to an object, the data type of the variable and object MUST match in order for the assignment to be successful.
True
If you are still initializing a variable, it cannot have a value.
False
A variable can have a value depending on the variable’s data type.
When you pass a variable to a method, you are passing the variable’s value.
True
Local variables are still not created when you enter a method.
False
Local variables are automatically created when you enter a method, and it is automatically destroyed when you exit the method.
String is an object.
True
You can call another constructor within the same class by creating an object at the first line of the body of another constructor.
False
You can call another constructor within the same class by using the this() at the first line of the body of another constructor.
We can instantiate a class by initializing or creating an object and giving it a unique name.
True
Yes, you declare an Array.
Ex:
int[] car, headphone;
or
int car[], headphone[];
True
Is this syntax right for initializing the Array?
quiz[] = new int (5);
False
quiz = new int[5];
Is this syntax right for adding values in Array?
String[] alphabet = new int {“a”, “b”, “c”, “d”};
False
String[] alphabet = {“a”, “b”, “c”, “d”};
The segment below will work, however the output is wrong.
String[] arr = {“earth”, “water”, “air”};
System.out.println(arr);
True
The output is [Ljava.lang.String;@79fc0f2f
Will this segment run?
String[] arr = {“earth”, “water”, “air”};
for(int i : arr){ System.out.println(i); }
False
The array type must match the array type of the index