Command Line Argument Processing in Java

A Java application can accept any number of command line argument. This allows the user to specify configuration information when the application is launched. When an application is launched, the runtime system passes the command line arguments to the application’s main method via an array of String s. Related Article: The Java Command – ‘java’ and ‘javaw’ Parameter Details … Read more

Java Commands & Options

The java commands supports a wide range of options: All options start with a single hyphen or minus-sign (-): the GNU/Linux convention of using — for “long” options is not supported. Options must appear before the or the -jar argument to be recognized. Any arguments after them will be treated as arguments to be passed … Read more

Maps in Java

The java.util.Map interface represents a mapping between keys and their values. A maps cannot contain duplicate keys; and each key can maps to at most one value. Since Maps is an interface, then you need to instantiate a concrete implementation of that interface in order to use it; there are several Maps implementations, and mostly … Read more

Immutable Empty Collections and iterators in Java with Examples

Sometimes it is appropriate to use an immutable empty collection. There are several ways to create immutable empty List in Java. The Immutable Empty Collections class provides methods to get such collections in an efficient way: List anEmptyList = Collections.emptyList(); Map anEmptyMap = Collections.emptyMap(); Set anEmptySet = Collections.emptySet(); These methods are generic and will automatically … Read more

Queues and Deques Interfaces in Java with Examples

Queues and Deques Interfaces in Java

The current Deques interface in java. Utility Package is a Queue interface subtype. The Deque is related to the double-ended queue that supports elements from either end of the data structure being added or removed. It can either be used as a queue(first-in-first-out/FIFO) or as a stack(last-in-first-out/LIFO). The usage of the PriorityQueue PriorityQueue is a … Read more

Primitive Data Types

Primitive Data Types in Java

The 8 primitive data types byte, short, int, long, char, boolean, float, and double are the types that store most raw numerical data in Java programs. The char primitive data types A char can store a single 16-bit Unicode character. A character literal is enclosed in single quotes char myChar = ‘u’;char myChar2 = ‘5’;char … Read more

Literals in Java

Literals in Java

Java is an Object-Oriented Program. Literals are a representation of a fixed value by source code. They ‘re explicitly interpreted without any computation in the code. Every primitive form variable can be assigned literal. Java literal is a syntactic element (i.e. something you find in the source code of a Java program) that represents a … Read more