Mapa mental
Chapter 2 Language Fundamentals
Contenido del mapa
Chapter 2 Language Fundamentals
Encoding sets
- ASCII
- 127 characters
- Each character is 7 bits
- Java uses it for almost all input elements
- Extended ASCII
- Had more characters from other languages
- Each character is 8 bits
- Latin-1
- Had characters for all latin based letters
- Also had 8 bits per character
- Unicode
- Exists to encode all characters from almost all different languages into one set
- Most widely used encoding set
- 32 bits per character
- Exists to encode all characters from almost all different languages into one set
- ASCII
Primitives
- byte
- any whole number between -2e7 and 2e7 - 1
- takes up 8 bits
- short
- takes up 16 bits
- any whole number between -2e15 and 2e15 -1
- int
- takes up 32 bits
- any whole number between -2e31 and 2e31-1
- float
- takes up 32 bits
- smallest positive nonzero = 14e-45
- largest positive nonzero = 3.4028234e38
- long
- takes up 64 bits
- any whole number between -2e63 and 2e63-1
- double
- takes up 64 bits
- smallest positive nonzero number = 4.9e-324
- largest positive nonzero number = 1.7976931348623157e308
- char
- A single unicode character
- boolean
- true or false
- byte
Variables
- Data Placeholders
- Every variable must have a declared type
- Reference type uses referred object as datatype
- Primitive type uses primitive datatype
- Java variables also need an identifier to distinguish from other variables when referencing
- Unlimited length sequence of java letters and java digits
- Java digits include ASCII digits 0-9
- Must begin with a java letter
- Java letters include uppercase and lowercase ASCII latin letters A-Z
- /u in front of a number denotes a unicode character
- Must not be a keyword like boolean or null
- Unlimited length sequence of java letters and java digits
- You can also assign a value to a variable while declaring the variable
- Variable names follow camel convention
Constants
- variables whose values don't change once assigned
- Declare by using keyword final
- By convention, constants are in all uppercase with words separated by underscores
- ex: final int ROW_COUNT = 50;
Literals
- Integer literals
- can be written in base 10, base 16, or base 8
- Hexadecimal integers (base 16) are written with prefix 0x or 0X
- Octal numbers are prefixed with a 0
- Used to assign value to byte, short, int and long type variables
- To assign a value to a long, suffix the number with L or l
- Can be expressed in binary by prefixing number with 0B or 0b
- Floating point literals
- Parts of a floating point number
- whole number part
- a decimal point
- A fractional part
- An optional exponent part
- the exponent part can be represented as either an e or an E
- 2 types of floating points
- double
- larger numbers (64 bits in size)
- float
- Smaller numbers (32 bits in size)
- double
- ex: Digits . [digits] [exponentPart] f or F
- f or F at the end makes the number a float otherwise it'd be a double
- You can explicitly express a double too
- suffix number in same format with a d or D instead of f or F
- You can explicitly express a double too
- exponent part is always formatted as "ExponentIndicator SignedInteger"
- Exponent indicator = e or E
- SignedInteger = plus or minus sign and a digit
- f or F at the end makes the number a float otherwise it'd be a double
- Parts of a floating point number
- Character literals
- Any unicode character enclosed in ' '
- Escape sequence
- \b = backspace key
- \t = tab key
- \\ = the backslash key
- \' = single quote
- \" = double quote
- \n = linefeed
- \r = enter key
- Boolean literals
- either "true" or "false"
- Integer literals
Java Separators
- Parenthesis ( )
- Brackets [ ]
- Braces { }
- Angle brackets < >
- Semicolon ;
- colon :
- Comma ,
- Period .
Información
- Descripción
- Mapa Mental sobre Chapter 2 Language Fundamentals, creado por Jean luc Choiseul el 30/09/2019.
- Creado por
- Jean luc Choiseul
- Visitas
- 0
- Valoración