Category Archives: Java

Chapter 17: Dates and Time (java.time.*)

Section 17.1: Calculate Dierence between 2 LocalDates Use LocalDate and ChronoUnit: LocalDate  d1  =  LocalDate.of(2017,  5,  1);LocalDate  d2  =  LocalDate.of(2017,  5,  18); now,…
Continue reading

Chapter 16: Date Class

Parameter                                                                         Explanation No parameter Creates a new Date object using the allocation time (to the nearest millisecond) long date Creates a new Date…
Continue reading

Chapter 15: Splitting a string into fixed length parts

Section 15.1: Break a string up into substrings all of a known length The trick is to use a look-behind with the regex…
Continue reading

Chapter 14: String Tokenizer

The java.util.StringTokenizer class allows you to break a string into tokens. It is simple way to break string. The set of delimiters (the…
Continue reading

Chapter 13: StringBuilder

Java StringBuilder class is used to create mutable (modifiable) string. The Java StringBuilder class is same as StringBuffer class except that it is…
Continue reading

Chapter 12: StringBuffer

Introduction to Java StringBuffer class. Section 12.1: String Buffer class Key Points: used to created mutable (modifiable) string. Mutable: Which can be changed.…
Continue reading

Chapter 2: Type Conversion

Section 2.1: Numeric primitive casting Numeric primitives can be cast in two ways. Implicit casting happens when the source type has smaller range…
Continue reading

Chapter 1: Getting started with Java Language

Section 1.1: Creating Your First Java Program Create a new file in your text editor or IDE named HelloWorld.java. Then paste this code…
Continue reading