Learn when to use setter methods or constructors for setting the value of a variable in Java.
Search Results for: var
How to Check if a Variable Is Defined in Thymeleaf
In this article, we learn how to check if a variable is defined in a Thymeleaf template.
Set an Environment Variable at Runtime in Java
Learn how to have more control over the environment variables, especially for test scenarios.
Static Final Variables in Java
In this tutorial, we learn how to declare and initialize constant variables.
Synchronize a Static Variable Among Different Threads
Learn several ways to synchronize access to static variables among different threads.
How to Set Up Environment Variables in IntelliJ IDEA
A quick and practical guide to setting up environment variables with Intellij IDEA.
How to Mock Environment Variables in Unit Tests
Learn how to write unit tests for code that uses environment variables with these Java testing libraries.
Unnamed Patterns and Variables in Java 21
Learn about an exciting preview feature in Java 21: unnamed patterns and variables.
Reading a JSP Variable From JavaScript
Explore several approaches to accessing a JSP variable from JavaScript.
Replacing Variables in a Document Template with Java
Learn how to replace a pattern in various locations of a Word document.
JAVA_HOME vs PATH Environment Variables
Explore the differences between using the JAVA_HOME and PATH environment variables.
Parsing Date Strings with Varying Formats
Explore strategies for parsing multiple date formats at once.
VarArgs vs Array Input Parameters in Java
A quick and practical comparison between varargs and arrays as input parameters.
Check If All the Variables of an Object Are Null
Explore the importance of checking for null variables in our Java classes.
Encoding of URI Variables on RestTemplate
Learn two methods for encoding URI variables on Spring’s RestTemplate.
Variable Instantiation on Declaration vs. on Constructor in Java
Learn that using either field declaration or constructor initialization is more of a preference.
A Guide to Variables in Postman
Learn about variables in Postman.
Toggle a Boolean Variable in Java
Learn how to build a null-safe method to toggle a given boolean variable in Java
Define an Array of Varying Types in OpenAPI
Learn how to define an array of varying types using the OpenAPI Specification.
Volatile vs. Atomic Variables in Java
Learn the difference between the volatile keyword and atomic classes and what problems they solve