OCA Java SE 7: Chapter 4: Using Primitives, Enumerations, & Objects – Flashcards

Unlock all answers in this set

Unlock answers
question
Chapter 4 Objective 1
answer
Understand Primitives, Enumerations, and Objects
question
What are primitives?
answer
Primitives are the fundamental data type in Java.
question
What type of primitive data type is " int " ?
answer
int is a primitive data type that is used to store integer values. It is the default value for whole numbers.
question
What type of primitive data type is " int " ?
answer
int is a primitive data type that is used to store integer values. It is the default value for whole numbers.
question
What is the "double " primitive type used to store and is it a default?
answer
double is a primitive data type for large floating-point values. It is the default value for floating-point numbers.
question
What is a boolean primitive type used to store?
answer
boolean is a primitive data type that is used to store true or false values.
question
What is the char primitive data type used to store?
answer
char is a primitive data type that is used to store a single Unicode character.
question
What is the " byte " primitive used to store?
answer
byte is a primitive used to store small numbers which are a byte (8 bits) or smaller.
question
What is the "short" primitive used to store?
answer
• short is a primitive used to store whole numbers up to 16 bits.
question
What is the "long" primitive used to store?
answer
• long is a primitive used to store large whole numbers up to 64 bits.
question
What is the "float" primitive used to store?
answer
• float is a primitive data type used to store floating-point values.
question
What case are primitive data types ?
answer
• Primitive data types all start with a lowercase letter, while classes start with an uppercase letter
question
Each primitive data type have a corresponding this?
answer
The have a corresponding " Wrapper class "
Each primitive data type has a corresponding wrapper class: Integer, Double, Boolean, Character, Byte, Short, Long, and Float. Notice the capital letters.
question
What are objects and what defines them?
answer
• Objects are more advanced data types. They may be defined by a developer or found in a built-in Java package.
question
Chapter 4 Objective 2
answer
Use Primitives, Enumerations, and Objects
question
How are Objects initialized?
answer
Objects must be initialized by using the new keyword.
question
What does Arrays allow you to store?
answer
• Arrays allow you to store multiple variables together that can be accessed by an index.
question
What does Enumerations allow a developer to create?
answer
•" Enumerations allow a developer to create" a predefined set of constants. A variable can then be set only to one of the predefined values.
question
Why Is Java considered a "strongly typed "language?
answer
• Java is a strongly typed language because Variables must be declared as a type, and any value that is stored must be compatible with this type.
question
Is it possible to cast a variable to a different data type?
answer
It is possible to cast a variable to a different data type. If incompatible types are cast, an exception will be thrown.
question
What is a literal ?
answer
• A literal is a value that is hard-coded in code as the value itself.
question
What are the Java naming conventions that dictate how a "class" should be named?
answer
• Java naming conventions dictate that a class should be named with the first letter capitalized, along with each sequential word in the name.
question
What are the Java naming conventions that dictate how a "variable" should be named?
answer
• Java naming conventions dictate that a variable should be named with the first letter being lowercase, and with each sequential word in the name beginning with a capital letter.
Get an explanation on any task
Get unstuck with the help of our AI assistant in seconds
New