devxlogo

Java

Building Javadocs from the Command Line

Some IDEs provide support for generating HTML from Javadocs automatically, but this can also be achieved using the command line: javadoc tool The most basic usage of the tool is

Using Optional in Java

With Java version 8, there is an option to assign null value to an object of type Optional. For example: Optional optionalVar = Optional.ofNullable(null); //Optional.ofNullable() accepts a null value to

Using NaN in Java

Java has a value NaN. The value has multiple faces and is returned under different circumstances. Below code samples will help us understand some of them. public class JavaNaN{public static

Running an Executable JAR File

Executable JAR files are the easiest way to assemble Java code into a single file which can be executed. Assuming that you have an executable JAR file with pathname ,

Find an IP Address by Name

Find the IP address of a server that you know, for example: google.com. Java, as usual, provides a very easy mechanism to retrieve the IP address of a server that

Dereferencing in Java

Dereferencing happens using the . operator: Object object = new Object();String text = object.toString(); // ‘object’ is dereferenced. Dereferencing pursues the memory address placed in a reference, to the place