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

Chapter 4 Objective 1Understand Primitives, Enumerations, and Objects
What are primitives?Primitives are the fundamental data type in Java.
What type of primitive data type is ” int ” ?int is a primitive data type that is used to store integer values. It is the default value for whole numbers.

What is the “double ” primitive type used to store and is it a default?double is a primitive data type for large floating-point values. It is the default value for floating-point numbers.
What is a boolean primitive type used to store?boolean is a primitive data type that is used to store true or false values.
What is the char primitive data type used to store?char is a primitive data type that is used to store a single Unicode character.
What is the ” byte ” primitive used to store?byte is a primitive used to store small numbers which are a byte (8 bits) or smaller.
What is the “short” primitive used to store?• short is a primitive used to store whole numbers up to 16 bits.
What is the “long” primitive used to store?• long is a primitive used to store large whole numbers up to 64 bits.
What is the “float” primitive used to store?• float is a primitive data type used to store floating-point values.
What case are primitive data types ?• Primitive data types all start with a lowercase letter, while classes start with an uppercase letter
Each primitive data type have a corresponding this?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.
What are objects and what defines them?• Objects are more advanced data types. They may be defined by a developer or found in a built-in Java package.
Chapter 4 Objective 2Use Primitives, Enumerations, and Objects
How are Objects initialized?Objects must be initialized by using the new keyword.
What does Arrays allow you to store?• Arrays allow you to store multiple variables together that can be accessed by an index.
What does Enumerations allow a developer to create?•” Enumerations allow a developer to create” a predefined set of constants. A variable can then be set only to one of the predefined values.
Why Is Java considered a “strongly typed “language?• 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.
Is it possible to cast a variable to a different data type?It is possible to cast a variable to a different data type. If incompatible types are cast, an exception will be thrown.
What is a literal ?• A literal is a value that is hard-coded in code as the value itself.
What are the Java naming conventions that dictate how a “class” should be named?• Java naming conventions dictate that a class should be named with the first letter capitalized, along with each sequential word in the name.
What are the Java naming conventions that dictate how a “variable” should be named?• 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.