Learn Java Programming

Java Basics

Bitwise Shift Operator, Bitwise Complement Operator, Binary Operators in Java

The Binary Operators such as Bitwise Shift Operator, Bitwise Complement Operator and Unsigned Right Shift Operators are supported in java that performs the bit level manipulation. The Binary operators such as AND, OR, NOT, XOR are performed using the Bitwise Operators. Java Bitwise operators manipulate individual bits of a number.

Switch Case Java

The Java switch case statement checks a variable with multiple values. The switch case in java matches the given value from multiple values and executes the corresponding switch statement. Java Switch contains multiple cases. Each switch case contains a block of code. The Switch case statement in java is a

Ternary Operator Vs If Else

The java ternary operator or conditional operator is supported in languages such as java, javascript, python, c / c++, c# etc. The java ternary operator or conditional operator takes three operands, one condition followed by a question mark (?), then an expression to be executed if the condition is true

Java program to write into a text file

There are several ways to write to a Java text file. Java supports different types of api to write file content. For example, write character by character, write line by line or write byte by by byte. Write to text file in Java In this post, we explained five types

Java Bean Standard, Specification, Properties, Requirements

A Java Bean is a java class that should follow the java bean standards and requirements. If a java class meets the java bean specification, the java class is called as java bean. The java bean has some properties and characteristics. A JavaBean is a java class which should follow

String index out of range

In Java, “String index out of range” exception is thrown in java substring() & charAt() method. Here, we see the exception “java.lang.StringIndexOutOfBoundsException: String index out of range: 0“. If a invalid value is passed in begin and end index value, “java.lang.StringIndexOutOfBoundsException: String index out of range” will be thrown. The

java.lang.NullPointerException at String.indexOf

The String.indexOf method return the index of the first occurrence of the matched string.If the matched string is passed as first parameter of String.indexOf method. If the matched string is null, NullPointerException is thrown by this method. The NullPointerException is thrown in the below String methods String.contains String.replace String.format РIf

java.lang.StringIndexOutOfBoundsException: String index out of range

The java.lang.StringIndexOutOfBoundsException: String index out of range arises when the string index is either negative, or larger than the length of the string, i.e. out of range The java string index range should be in between 0 and the size of the string. The java String.charAt() method returns the character

java.io.UnsupportedEncodingException example

The java.io.UnsupportedEncodingException occurs when an unsupported character encoding scheme is used in java strings or bytes. The java String getBytes method converts the requested string to bytes in the specified encoding format. If the java does not support the encoding format, the method String getBytes throws java.io.UnsupportedEncodingException with the encoding

java.util.regex.PatternSyntaxException at String.matches, String.split, String.replaceAll

The java.util.regex.PatternSyntaxException is thrown when the regular expression – regex pattern is not correct. The java String matches method checks the given string with the specified regular expression. If the java string matches the regular expression, it will return true, otherwise it will return false. The java exception java.util.regex.PatternSyntaxException is