Learn about private constructors in Java.
Search Results for: const
Defining Unique Constraints in JPA
Learn how to define unique constraints on entity classes in JPA and Hibernate.
What Are Compile-Time Constants in Java?
The Java compiler is able to pre-calculate certain values for us at compile time. This allows us to use some variables with expressions that must be constant, and leads to some runtime efficiencies.
Where Does Java’s String Constant Pool Live, the Heap or the Stack?
Learn about the storage area for String constant pool.
An Introduction to the Constant Pool in the JVM
Learn about the constant pool in JVM.
Constants in Java: Patterns and Anti-Patterns
Learn about using constants in Java with a focus on common patterns and anti-patterns
Why Not to Start a Thread in the Constructor?
Learn why you shouldn’t start a thread in a Java constructor
The Constructor Return Type in Java
Learn about the constructor return type in Java
Constructing a JPA Query Between Unrelated Entities
Learn to construct a JPA query between unrelated entities.
Fixing “constant string too long” Build Error
Learn to fix the “constant string too long” build error in Java.
Grouping Jakarta (Javax) Validation Constraints
A quick and practical overview of grouping Javax validation constraints.
Java Copy Constructor
Here’s how to create copy constructors in Java and why to implementing Cloneable isn’t such a great idea.
Hibernate Validator Specific Constraints
Explore the constraints in Hibernate Validator that go beyond the minimal set defined in the Bean Validation specification.
Generic Constructors in Java
Learn how to use generic constructors in both generic and non-generic Java classes.
Cannot Reference “X” Before Supertype Constructor Has Been Called
Find out why the compiler will not let you call an instance method too early in a constructor and what you can do to fix it.
Spring PostConstruct and PreDestroy Annotations
Learn about Spring’s lifecycle annotations PostConstruct and PreDestroy.
A Guide to Constructors in Java
Learn the basics about constructors in Java as well as some advanced tips
Difference Between @NotNull, @NotEmpty, and @NotBlank Constraints in Bean Validation
Learn the semantics of the @NotNull, @NotEmpty, and @NotBlank bean validation annotations in Java and how they differ.
Synthetic Constructs in Java
Learn about the compiler-added binding code pieces that enable transparent usage of some of Java’s features
Java Constructors vs Static Factory Methods
Learn about static factory methods in Java and why they’re sometimes preferred over constructors for instantiating and initializing objects.