Home » Core Java » lang

lang

java.lang.ProcessBuilder Example

In this article, we are going to discuss the ProcessBuilder API. But first, lets understand the use of ProcessBuilder. One can guess by its name that it has something to do with building processes. ProcessBuilder can be used to help create operating system processes. Before JDK 5.0, the only way to start a process and execute it, was to use ...

Read More »

java.lang.System Example

In this tutorial we will discuss about the System class in Java. It contains a number of useful fields, such as the standard input, the standard output and the standard error streams. The System class is declared as final and thus, it cannot be instantiated. Also, the System class contains a large number of methods that can be used to ...

Read More »

Java equals method Example

In this example we will discuss about equals() method. This is one of the methods that all objects have, since it is defined in the Object class, which is the base for all Java classes. This method’s functionality is to check if the object invoking this method is equal to another object passed as an argument. It should return true ...

Read More »

Java hashCode method Example

In this example we will discuss about hashCode() method. This is one of the methods that all objects have, since it is defined in the Object class, which is the base for all Java classes. This method’s functionality is to digest the properties of an object into a single, 32-bit integer value. The hashCode() method should return a unique value ...

Read More »

Java System Properties Example

In this example we are going to demonstrate how to use Java System Properties. Java application can read System Properties, which provide information about the local system and configuration. When the java VM starts, its inserts local system properties into a system properties list. You can then use methods defined as part of the System Class to maintain the value of ...

Read More »

Java StringBuffer Example

In this example we are going to present the StringBuffer class, which is contained in the java.lang package. We are going to show some of its most important uses and methods, and explain why and when it should be used, as well as the difference between StringBuffer and String. 1. String vs StringBuffer Strings in Java are immutable. This means that ...

Read More »

Java Runnable Example

In this example we will take a look into the Runnable interface in Java, and how it can be used in association with the Thread class to create and execute new threads in your program. We will also try to explain what a Runnable is and what’s the difference from Thread, as well as take a look into the different ways ...

Read More »

Java String Replace Example

In this example we will show how to modify a string by replacing either characters or sequences of characters included in the string with different ones. 1. String Replace methods in Java The String provides 4 methods for replacing strings. String replace(char oldChar, char newChar) This method replaces every occurrence of the oldChar in the string with the newChar and ...

Read More »

Java String getBytes Example

We all know that every single piece of code consists of bytes. So do the Strings, this Java class type, that can represent text and words inside a Java program. In order to convert bytes into characters, Java needs to know what to represent, in which language, and what each character means in every language in the world. This is ...

Read More »

Want to take your Java skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • Spring Interview QnA
  • Multithreading & Concurrency QnA
  • JPA Minibook
  • JVM Troubleshooting Guide
  • Advanced Java
  • Java Interview QnA
  • Java Design Patterns