Java Comparator Interface

There are many situations when we often need to compare two values in our Java programs. Comparing primitive values like int, char, float, boolean, etc., is very easy and we can compare them using the comparison operators like <, >, ==, etc. But what if we want to compare objects? For example, How would youContinue reading “Java Comparator Interface”

Java Strings Methods

Methods of Java String Class The methods of String class are used to obtain information about objects and are known as accessor methods. The String class provides many accessor methods that are used to perform operations on strings. We will cover some important methods of the String class in detail with the help of examplesContinue reading “Java Strings Methods”

Java Type Casting

What is Type Conversion in Java? Type Conversion or Type Casting is the process of converting a variable of one predefined type into another. If these data types are compatible with each other, the compiler automatically converts them and if they are not compatible, then the programmer needs to typecast them explicitly. Types of TypeContinue reading “Java Type Casting”

Array vs ArrayList

What is an Array in Java? An Array is a fixed-length data structure in Java that stores the elements of similar data types in contiguous memory locations. We have to specify the size of the array during the array creation. What is an ArrayList in Java? An ArrayList is a dynamic length collection framework inContinue reading “Array vs ArrayList”

Password validation using Exception handling

1.Get the password. 2.Create a regular expression to check the password is valid or not as mentioned below: ^ represents starting character of the string. (?=.*[0-9]) represents a digit must occur at least once. (?=.*[a-z]) represents a lower case alphabet must occur at least once. (?=.*[A-Z]) represents an upper case alphabet that must occur atContinue reading “Password validation using Exception handling”

Java Exception Handling with Examples

Errors occur naturally when we create and develop programs. Sometimes, we misspell a name or keyword, or sometimes we unknowingly change the symbols. These are very common and easy to handle errors. But programming is not that easy, and errors are not that simple. So, to handle virtually any type of errors that may occur,Continue reading “Java Exception Handling with Examples”

Day-29 Binary Search in Datastructure

There are various ways to search a particular element from a given list. One of them is Binary search.When there exists so much data everywhere, it is very necessary to have a good searching method to search for the particular data in lesser time. Binary search works faster than linear search. It is one ofContinue reading “Day-29 Binary Search in Datastructure”

Design a site like this with WordPress.com
Get started