Values and Data Types Flashcards
What is a character set?
A character set is a defined list of characters recognized by a language
What does a character set consist of?
- Alphabets: letters, A-Z, a-z
- Numerals: digits, 0-9
- Special characters: ?, %, }, >, @, etc.
What are the alphabets and numerals collectively known as?
The alphanumeric character set
Name two standard character sets
ASCII and Unicode
What does ASCII stand for?
American Standard Code for Information Exchange
What is ASCII?
It is a 7-bit set of codes that defines 128 different characters
What is the ASCII character set enough to represent?
It is enough to represent every uppercase letter, lowercase letter, digit, and special character used in the English Language keyboard.
What is Unicode?
It is an international character set designed to represent all the characters found in languages around the world, such as English, Hindi, Japanese, Chinese, French, Geman
How many bits can Unidode use to represent a character?
8 to 32 bits
Which character encoding does Java use?
The Unicode character coding
How is a specific Unicode character expressed?
By using the escape sequence ā\uā followed by its four digit hexadecimal code
What is the extended ASCII code?
It is an 8-bit character set that defines 256 different characters (2^8 = 256), including the standard 7-bit ASCII characters
What are tokens?
Tokens are the smallest individual units of a Java program. All characters in a Java program are grouped into symbols called tokens.
How many categories of tokens are in Java?
- Keywords
- Literals
- Operators
- Punctuators
- Identifiers
What are keywords?
Keywords are the words that have a special meaning to the Java compiler
What is another name for keywords?
Reserved words
Why are keywords not available as names for variables or methods?
Java compiler reserves keywords for its own use, and hence they are not available
Which keywords are currently not used in Java?
goto and const
Name words you cannot use as variable names despite them not being keywords
true, false, null, literal values
What are identifiers?
They are fundamental building blocks of a program & are used to name different components of a program, such as variables, methods, and objects
What are the fundamental building blocks of a program?
Identifiers
What are Java identifiers naming conventions?
- An identifier can consist of any combination of letters, digits, underscore character, dollar sign
- It cannot begin with a digit
- It may be of any length
- Both uppercase and lowercase letters can be used in naming an identifier
- Java is case sensitive, which means that two identifier names that differ only in uppercase and lowercase characters are considered to be different identifiers
- An identifier cannot be a keyword or a boolean literal or a null literal
What are literals?
They are a sequence of characters that represent values in a program and are stored in variables. Literals are made out of digits, letters, and other characters
Name the types of literals Java supports
- Numeric -> Integer and Real
- Non Numeric -> Character and String
- Boolean
- Null