Java Module 2 Vobab

¡Supera tus tareas y exámenes ahora con Quizwiz!

Strongly Typed Language

A language in which the programmer must explicitly state the data type for variables, function return types, and any other place where values are stored or passed. This allows the compiler to check that only allowed data items are used in those places and helps prevent the errors that can happen when unexpected data shows up. Java and related languages are strongly typed. Examples of languages that are not strongly typed would be Python, JavaScript, and PHP.

Initialize

Assigning a value to a variable

Narrowing Conversion

In a narrowing conversion, which you will do through casting, a value of a large data type is assigned to a variable of a smaller data type, such as casting from a long to an int. If the value fits in the smaller data type, there is no problem. However, if the value is too large for the range of the smaller data type, part of the value is lost.

Short Circuit Logical Operator

In a regular logical operator, both operands (the values on either side) are evaluated before a result is returned. The short circuit logical operator will only evaluate operands until it has enough information to determine if the expression is true or false. For example when using the short circuit AND operator (&&), both operands must be true for the expression to be true. If the first operand is false, the entire expression is going to be false, so why waste time evaluating the second operand?

Logical Operator

This allows you to combine boolean expressions to form more complex boolean expressions.

Double

This data type is larger of two primitive data types representing a fractional number.

Float

This data type is smaller of two primitive data types representing a fractional number. When defining a float literal value, append an f to the end or Java will default to double. For example: 1.25f

Long

This data type represents an integer value (whole number) like an int, but can hold much large numbers. When you specify a long literal value, you must append the letter L to the end or Java will try to interpret the value as an int by default. Note: you can use either the uppercase or lowercase L, but you will want to use the uppercase for improved readability: 100L vs 100l.

Int

This is the most common of the integer (whole number) primitive data types and the one you will typically use unless you have an explicit reason to do otherwise.

True

This is the reserved keyword representing a boolean value of true.

Literal

This value is one that you type directly in your code in human-readable form. This is different from values that are generated later when the program runs.

Increment

To add one to a value.

Automatic Type Conversion

When assigning a value of one type to a variable of another type, Java can automatically convert the value to the type of the variable, as long as the types are compatible and there will be no loss of data.

Type Conversion

When we convert a value from one data type to a different data type.

Octal Literal

a base 8 number (as opposed to the base 10 that you normally use). To create an octal literal, you enter a zero followed by a series of digits from zero to seven, i.e.: 017 which is equivalent to the decimal value 15.

Primitive

a data type where a simple bit pattern represents the actual value. This is different from reference (non-primitive) types in Java where the bit pattern represents the address in memory where the value exists.

Char

a primitive data type representing a single Unicode character. Denote a char by placing the character in single quotes, i.e.: 'X'. Note that a character is different from a String.

Binary Literal

a sequence of 1 and 0 values together and preceded by a zero and the upper or lower case letter 'b'. For example: 0b0101 or 0B0101.

String Literal

a sequence of characters placed inside double quotes: "This is a String literal". Note that this is different from the char which uses the single quotes. Because they are not the same data type, 'X' does not equal "X". Also note that String is not a primitive data type.

Escape Sequence

a special character consisting of a backslash (i.e: \) and then a character. The two items are treated as one and signifies a particular operation. For example, the character '\n' represents a newline when printing, where as a '\t' specifies a tab. To include the actual backslash in a String, use two backslashes next to each other thusly,, '\\'.

Operator

a symbol that tells the computer to perform some operation.

Hexadecimal Literal

a value in hexadecimal, using the character 0-9 and A-F preceded by a zero and the letter x: 0xA34F

Unicode

an encoding standard that allows us to represent letters from all human languages. Java uses Unicode because we can write Java programs for anyone regardless of the language they use. In Java II, you will learn about Internationalization.

Arithmetic Operator

an operator that performs basic math functions such as adding, subtracting, multiplying, and dividing.

Short

data type represents an integer (whole number) like an int, but with a much smaller range of values available.

Scope

defines the code block in which a variable was defined. Code within that same block or any blocks contained in that block (nested blocks) can reach the variable. Code outside of the block cannot access the variable. When the block is complete and ceases to exist, the variable no longer exists either.

Relational Operator

returns information on the relationship between its operands. Common examples are determining if to values are equal, is one larger than another, and similar. The results are always boolean values.

Data Type

tells the computer how to interpret the ones and zeros that make up a value. For example, the bit sequence 1000001 could by the integer value 65 or the uppercase letter A in Unicode. Specifying a data type is the only way to know which is intended.

False

the reserved keyword representing a boolean value of false.

Operator Precedence

the series of rules that specify which operator should go first when there is more than on in the same expression.

Lifetime of a Variable

the time from when it is declared until it is no longer available to the program. A variable will only last while the scope in which it was declared exists.

Boolean

this data type is a primitive type that represents either true or false.

Byte

this data type represents a type that can only contain a byte of data which translates as an 8-bit integer.

Decrement

to subtract one from a value.

Scientific Notation

used to represent very large or very small numbers as a value multiplied by ten raised to a particular power. In Java, we represent the 10 with the letter E (upper or lowercase). For example 2.5E14 translates to 2.5 times 10 raised to the 14th power. You can use scientific notation to enter floating point literals.

Widening Conversion

when a value is converted from one data type to another data type that is capable of holding much larger values. An example would by converting a short value to an int.

Cast

you place the intended data type into parentheses immediately to the left of the value being cast.


Conjuntos de estudio relacionados

Chapter 1 - Insurance Regulations

View Set

REG 7 - Property & Special Property Tax Transactions

View Set

Quiz: Applying an Extremity Restraint

View Set