Java Keywords

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

Keywords. In learning Java, we can start with just a single part. We do not need to learn all things at once. Programs too are composed of pieces—keywords.

Keyword list. Some keywords, like for and while, control iteration. Others provide branching, like if. We use all these terms together to form complete programs.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.ArrayDequeArrayListArrayBitSetBufferedReaderBufferedWriterCharacterCalendarCollectionsComparableComparatorDateEnumMapExceptionFilesHashMapHashSetHashtableInputStreamInputStreamReaderIntegerIntStreamMatcherMathObjectObjectsOptionalPatternPriorityQueueProcessProcessBuilderRandomRuntimeStackStackOverflowErrorStreamStringStringBufferStringBuilderTreeMapURIURLVector

Numbers. 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

Methods. 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

Static. 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

Algorithms. 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

Ciphers. 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

Files. 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

Factory. 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

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

A review. 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.
Dot Net Perls
© 2007-2020 Sam Allen. Every person is special and unique. Send bug reports to