Java Keywords and Best Practices

Keywords

There are some words which holds specific meaning and operation in Java language. These words are called Keywords. One should use these keywords as defined inside Java, should not use as we want like as variables, classes or methods etc.

Almost fifty keywords are defined currently. We will learn about each keyword when we need in later lessons.

abstract assert boolean break byte case
catch char class const continue default
do while else enum extends final
finally float for goto if implements
import instanceof int interface long native
new package private protected public return
short static strictfp super switch synchronized
this throw throws transient try void
volatile while true false null

Code Blocks

Code block is one of the key elements of Java language. A code block is a group of 2 or more statements. Every code block opens with opening curly brace { and ends with ending curly brace }. Code blocks mainly useful in simplifying the coding of algorithms and usage increases readability. More important point is these { and } does not exists in executable only exists in source code.

Semicolon

As we will be writing so many statements in our program, Java should know where each statement is starting and ending. To denote this we have to use semicolon ; at the end of each statement. This denotes end of one operation or logical entity.

Indentation

In our first program you might have observed, I have followed some indentation for my statements. Of course do not need these indents, but over many years it has been developed for better readability of program. It is not mandatory to indent but it is advisable to follow.

Java Libraries

In our first program we have used a built-in method println. This is defined in Java’s predefined class System. Like this way we use so many predefined classes in Java depending on our requirement and algorithm. In short Java is combination of Java Language and these libraries. Java provides libraries for I/O, String handling, graphics, data structures, networking and GUI (Graphical User Interface). To become a Java Programmer you have to learn these libraries also. Java library is one thing which you have to explore on your own.

<<< Java and JVM InternalsJava Variables >>>
Copyright 2005-2016 KnowledgeHills. Privacy Policy. Contact .