Java Basics
java.util.regex.PatternSyntaxException: Unexpected internal error near index 1
The backward slash “\” is used to escape characters in the java string. If a string contains a backward slash “\”, a escape character is added along with backward slash “\”. For example, a String “Yawin\tutor” is created as “Yawin\\tutor” in java. In regular expression if you use single backward
java.util.regex.PatternSyntaxException: Illegal repetition
The java.util.regex.PatternSyntaxException: Illegal repetition exception occurs when the regex dialects ‘{’ and ‘}’ are not used for repetition qualifier. In java, the regular expression dialects ‘{‘ and ‘}’ have special meaning. They are the opening and closing tokens for the {m, n} repetition quantifier where m and n are integers.
java.util.regex.PatternSyntaxException: Unclosed counted closure near index
The java exception java.util.regex.PatternSyntaxException: Unclosed counted closure near index occurs when a string matches by the regular expression special character ‘{’ open curly bracket without close curly bracket. In a search string, the special character (close curly bracket) must be added. The regular expression uses the “{ }” curly bracket
java.util.regex.PatternSyntaxException: Illegal repetition near index
The java.util.regex.PatternSyntaxException: Illegal repetition near index 0 exception occurs when the regular expression special characters such as $ { } are used inside the java search string. When processing in the regular expression, the special characters have significant meaning. It is necessary to add a special character with an escape
java.util.regex.PatternSyntaxException: Illegal character range near index
The java exception java.util.regex.PatternSyntaxException: Illegal character range near index occurs when an Illegal or inappropriate character range is used to match the regular expression. The range is defined by a hyphen in between minimum and maximum values. If an invalid minimum or maximum value is specified in the regular expression,
How to fix NullPointerException in Java
The java.lang.NullPointerException occurs when a java variable does not point to any object and is accessed for any operation. The java.lang.NullPointerException is a runtime exception. The java.lang.NullPointerException is an exception to runtime. The java NullPointerException occurs when a variable is declared but is not assigned to an object until you
How to solve java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
The java.lang.ClassNotFoundException: com.mysql.jdbc.Driver exception occurs if the MySQL JDBC driver class can not found in the java class path. The Class.forName() fails to loads the mysql driver class that is not available in the class path. If the MySQL JDBC driver jar is not available, or if the jar is
java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/testdb
The java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/testdb exception occurs if the suitable driver is not found to connect mysql database from java application. The MySQL JDBC driver is not loaded in java either because the driver jar is not available in the class path, or because it is not
Loading class `com.mysql.jdbc.Driver’. This is deprecated. The new driver class
The Java exception Loading class com.mysql.jdbc.Driver'. This is deprecated. The new driver class iscom.mysql.cj.jdbc.Driver’. occurs because the deprecated mysql driver class is configured or used in the mysql database connection. This exception will be shown in framework such as spring, spring boot, hibernate etc. The MySQL JDBC driver class is
Java Thread Synchronization not working – Troubleshoot
Synchronized keyword is not working in java because the thread lock object is not correctly attached to the thread. Because of this, the Java thread synchronisation doesn’t work as expected. The main reason is that each thread will create a new object and lock the object. There’s no synchronisation going