- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 2616 Articles for Java
466 Views
Here, we will demonstrate escaping characters in Regex through Java Program. Before diving deep into the topic, let us get acquainted with the term Escaping Characters and Regex. Regex It is an acronym for a Regular expression. It is an API that offers users to define String patterns that are useful for finding, modifying, and editing strings. A couple of areas of strings where Regex is frequently used to define the limitations include email validation and passwords. The java.util.regex package encompasses regular expressions. Escape character When a character is preceded by a backslash (\), it includes numbers, alphabets, and ... Read More
94 Views
Hamming distance between two strings of equal length is the number of all the positions at which a different value exists at the corresponding position of the other string. We can understand this with an example given below − S = “ramanisgoing” T = “dishaisgoing” Here, 5 is the hamming distance between two strings S and T as raman and disha are two words that make a difference in the strings to become equal. Problem Statement However, in this problem, we need to find the hamming distance between two strings that contain binary numbers only. One string would be ... Read More
52 Views
Concatenation is an operator which is used to join one or more than one string to originate a new string which would be a combination of strings that were used to generate it with the help of concatenation. In the following article, we will take the uppercase letters only in the input string. Concatenation is an operator which is used to join one or more than one string to originate a new string which would be a combination of strings that were used to generate it with the help of concatenation. In the following article, we will take the uppercase ... Read More
148 Views
There are 26 total different alphabets exist in the English language. If we want to change the alphabet characters into numerical values then we need to assign the alphabet, values between 1 to 26 only. Now, in this problem, we need to Maximize the String value by assigning values in the range [1, 26] to each character. Let us see how we should proceed to solve this problem. Let’s try to understand this problem with the help of some examples. Input s = “blpsBpPtT” Output 221 Explanation Here, in this ... Read More
73 Views
A numerical string is used to store a value of a number if we want to store a huge valued integer. As we know, we can not store a number greater than 32 bits in the computer with its datatype as int. So to avoid the overflowing condition, in this problem, we will take a numerical string as our input rather than an int variable so that we can work this problem on a larger scale of numbers. Problem Statement Now, in this problem, we need to find the following number by adding natural numbers in order on alternating indices ... Read More
222 Views
Substrings are the subsets or sequences of contiguous characters of a string. Now, in this problem, we need to find the number of substrings with the frequency of at most one character as odd. Let us see how we should proceed to solve this problem. Let’s try to understand this problem with the help of some examples. Input s = “ksjssjkk” Output 21 Explanation − As the frequency of the characters in the given string is given below− k → 3 s → 3 j → 2 Now, substrings with ... Read More
503 Views
The sum of the series is the value of all terms in the given series added together in a particular pattern. Here given pattern is in the form of the: ∑ (n*(n+1)*(n+2)) as (n*(n+1)*(n+2)) is the last term in the given pattern. The following article discusses 3 approaches in detail to find the given sum of the series with different time and space complexities. Problem Statement Now, let us see how to calculate the sum of series 1*2*3 + 2*3*4 + 3*4*5 + . . . + n*(n+1)*(n+2). Sample Examples Let’s try to understand this problem with the help ... Read More
219 Views
Lexicographic means the algorithm by using which we can arrange given words in alphabetical order, the same concept which is used in dictionaries. The largest possible string that we would get by merging two strings taking one-character element at a time so that the order is lexicographic can be obtained by arranging alphabets in decreasing order or descending order keeping the sequence of elements in mind. Problem Statement Now, in this problem, we need to find lexicographically the largest possible string we get by merging two given strings. To understand this problem, we should know the basic concept we use ... Read More
298 Views
A Hashtable is a powerful data structure in Java that allows programmers to store and organise data in key-value pairs. Many applications need retrieving and displaying entries from a Hashtable. In a Hashtable, any non-null object can serve as a key or a value. However, for successful storage and retrieval of items from the Hashtable, the objects used as keys must implement both the equals() method and the hashCode() method. These implementations ensure proper handling of key comparisons and hashing, enabling efficient management and retrieval of data within the Hashtable. Through the utilization of the keys() and elements() ... Read More
75 Views
The ability to interact with databases is an important requirement for many software programs in this data-driven world. Java is a versatile and robust programming language that offers Java Database Connectivity (JDBC), an effective mechanism that enables smooth interaction with different database systems. JDBC is an API that offers a standardised interface for Java applications to communicate with databases. We can perform operations like querying, inserting, updating, and deleting data using it as a bridge between the Java application and the database. This article helps us to delve into the world of Java's JDBC API, enabling us ... Read More