Java Keywords

Learn about keywords in the Java language. Review core parts of Java.


You are in a dark cave. Suddenly a flash of light appears. A torch illuminates the area. Particles of light (like neurons in the brain) pass their messages.

Keyword list.

Like the light makes things visible, keywords make a Java program meaningful. Each term tells us what a part of the program does.abstractbooleanbreakbytecasecatchclasscontinuedefaultdodoubleelseenumextendsfalsefinalfinallyfloatforifimplementsimportintinterfacelongnewnullpackageprivateprotectedpublicreturnshortstaticsuperswitchthisthrowthrowstruetryvoidwhile

Common classes.

Programs use classes to create complex models and perform various tasks. With keywords we specify and create these classes. Here are some important classes.ArrayDequeArrayListArraysBitSetBufferedReaderBufferedWriterCharacterCalendarCollectionsComparableComparatorDateEnumMapExceptionFilesHashMapHashSetHashtableInputStreamInputStreamReaderIntegerIntStreamMatcherMathObjectObjectsOptionalPatternPriorityQueueProcessProcessBuilderRandomRuntimeStackStackOverflowErrorStreamStringStringBufferStringBuilderTreeMapURIURLVector


Types like int are numeric types. We can use operators, like + to change numeric types. For larger, more detailed numbers, double is useful.Numbers: Bit CountNumbers: Integer.MAX_VALUENumbers: MathNumbers: ModuloNumbers: OddNumbers: Parse IntNumbers: PrimeNumbers: RandomNumbers: Truncate


In structured programs, we call methods. And those methods themselves call further methods. This interaction rapidly becomes powerful.MethodsMethods: OverloadedMethods: OptionalMethods: Multiple Return ValuesMethods: Reflection


Something that is static is singular. It is all alone and this aspect of it cannot be changed. In Java we find static fields, methods and initializers.StaticStatic Initializer


With methods, we often implement more complex algorithms. Some algorithms are famous, like binary search, but many are more specific to a program.Algorithm: AnagramAlgorithm: Binary SearchAlgorithm: Compound InterestAlgorithm: FibonacciAlgorithm: PalindromeAlgorithm: RecursionAlgorithm: Tree


These are a kind of algorithm—one of the oldest. With ciphers, a message can be "obscured" so that is no longer easily read.Cipher: CaesarCipher: ROT13

String algorithms.

Many algorithms involve strings. We can extract parts of strings or test strings in complex ways. Performance is often important when handling strings.Strings: Duplicate CharsStrings: First WordsStrings: RightStrings: Word Count


With files we store data in a more permanent way. We use types like BufferedReader and BufferedWriter. Java has robust file support.File: BufferedReaderFile: BufferedWriterFile: CopyFile: Count Letter FrequenciesFile: Count Lines


This is a design pattern. It is used to unify the creation of a diverse group of objects with a common ancestor. As with other design patterns, it helps simplify large programs.Factory


The Google Java library, called Guava, offers additional classes. For example, an ImmutableList cannot be modified. With Splitter and Joiner we handle strings.ImmutableListJoinerListMultimapSplitter

Java has many classes.

But using the most common ones is a good idea. Much like a musical symphony, the flow of a Java program is important. You will develop a masterpiece.
Dot Net Perls
© 2007-2019 Sam Allen. All rights reserved. Written by Sam Allen,