Chapter 10: Dates and Time (Java - Time. )
Chapter 10: Dates and Time (Java - Time. )
37
Section 9.8: Creating Date objects ............................................................................................................................ 38
Section 9.9: Comparing Date objects ........................................................................................................................ 38
Section 9.10: Converting String into Date ................................................................................................................. 41
Section 9.11: Time Zones and java.util.Date .............................................................................................................. 41
Chapter 10: Dates and Time (java.time.*) ...................................................................................................... 43
Section 10.1: Calculate Dierence between 2 LocalDates ....................................................................................... 43
Section 10.2: Date and time ........................................................................................................................................ 43
Section 10.3: Operations on dates and times ........................................................................................................... 43
Section 10.4: Instant ..................................................................................................................................................... 43
Section 10.5: Usage of various classes of Date Time API ....................................................................................... 44
Section 10.6: Date Time Formatting .......................................................................................................................... 46
Section 10.7: Simple Date Manipulations ................................................................................................................... 46
Chapter 11: LocalTime ............................................................................................................................................... 48
Section 11.1: Amount of time between two LocalTime ............................................................................................. 48
Section 11.2: Intro ......................................................................................................................................................... 49
Section 11.3: Time Modification ................................................................................................................................... 49
Section 11.4: Time Zones and their time dierence ................................................................................................. 49
Chapter 12: Literals .................................................................................................................................................... 51
Section 12.1: Using underscore to improve readability ............................................................................................ 51
Section 12.2: Hexadecimal, Octal and Binary literals ............................................................................................... 51
Section 12.3: Boolean literals ...................................................................................................................................... 52
Section 12.4: String literals .......................................................................................................................................... 52
Section 12.5: The Null literal ........................................................................................................................................ 53
Section 12.6: Escape sequences in literals ................................................................................................................ 53
Section 12.7: Character literals ................................................................................................................................... 54
Section 12.8: Decimal Integer literals ......................................................................................................................... 54
Section 12.9: Floating-point literals ............................................................................................................................ 55
Chapter 13: Operators .............................................................................................................................................. 58
Section 13.1: The Increment/Decrement Operators (++/--) .................................................................................... 58
Section 13.2: The Conditional Operator (? :) ............................................................................................................. 58
Section 13.3: The Bitwise and Logical Operators (~, &, |, ^) ..................................................................................... 60
Section 13.4: The String Concatenation Operator (+) .............................................................................................. 61
Section 13.5: The Arithmetic Operators (+, -, *, /, %) ................................................................................................ 63
Section 13.6: The Shift Operators (<<, >> and >>>) ................................................................................................... 65
Section 13.7: The Instanceof Operator ...................................................................................................................... 66
Section 13.8: The Assignment Operators (=, +=, -=, *=, /=, %=, <<=, >>= , >>>=, &=, |= and ^=) ................................. 67
Section 13.9: The conditional-and and conditional-or Operators ( && and || ) ..................................................... 69
Section 13.10: The Relational Operators (<, <=, >, >=) ............................................................................................... 70
Section 13.11: The Equality Operators (==, !=) ............................................................................................................. 71
Section 13.12: The Lambda operator ( -> ) ................................................................................................................ 73
Chapter 14: Primitive Data Types ...................................................................................................................... 74
Section 14.1: The char primitive .................................................................................................................................. 74
Section 14.2: Primitive Types Cheatsheet .................................................................................................................. 74
Section 14.3: The float primitive ................................................................................................................................. 75
Section 14.4: The int primitive ..................................................................................................................................... 76
Section 14.5: Converting Primitives ............................................................................................................................ 77
Section 14.6: Memory consumption of primitives vs. boxed primitives .................................................................. 77
Section 14.7: The double primitive ............................................................................................................................. 78
Section 14.8: The long primitive .................................................................................................................................. 79