Tag: java
1. Presentation of the context : The model is as described below : The repository is: The SQL query in data.sql used for inserting new users is: 2. The exception : While inserting a new user via the repository, Hibernate throws “ConstraintViolationException: could not execute statement” when inserting a new . . . Read more
1. The exception : Using the PDFBox library, we got the following exception : 2. The root cause of the exception : In the project, we use the following configuration of the maven resources plugin : The resources directory contains : At the maven resources plugin site, it is mentioned . . . Read more
The NumberConfiguration class uses a decimal separator with type char. The separator values contain the char space ‘ ‘. By calling the listAll() method via the NumberConfigurationRepository, Hibernate throws the following StringIndexOutOfBounds Exception: This exception is generated because at least one row of the table contains the space character ‘ . . . Read more
The goal of this tutorial is to set up a maven and Spring Boot configuration allowing to build and package the project as jar file as well as war file which can be deployed under an application server like Tomcat. Through this tutorial, we will be able to build and . . . Read more
The twin of a word is a word written with the same letters (independent of case), but not necessarily in the same order.For example “Outlook” is the twin of “Lookout”. The isTwin(a, b) method returns true if b is the twin of a or false if it is not. a . . . Read more
1. Difference between JDK and JRE : The JRE is the Java Runtime Environment. It is a collection of everything needed to run a compiled Java program, including the Java Virtual Machine (JVM), Java class library, java command, and other frameworks. However, it cannot be used to create new programs. . . . Read more
In order to compare the values of two strings, we use the equals() method or Objects.equals() method. Objects.equals() checks for null before calling equals() method. While the == operator is used to compare the references of two string objects. Output :
Output :
We consider the sequence of numbers in which a number is followed by the same number plus the sum of these digits. For example 34 is followed by 41 (41 = 34 + (3+4)). 41 is itself followed by 46 (46 = 41 + (4+1)). Two sequences with different starting . . . Read more
Check if a string is composed of parentheses and square brackets recursively in Java The program below identifies a string composed of parentheses ( ) and square brackets [ ]. A string of this type is considered correct : If it is an empty string or null If the string . . . Read more