- 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
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
43 Views
The java.util.regex.MatcheResult interface provides methods to retrieve the results of a match.You can get an object of this interface using the toMatchResult() method of the Matcher class. This method returns a MatchResult object which represents the match state of the current matcher.The end(int group) method of this interface accepts an integer representing a particular group and returns the offset before the first match occurred in the specified group.Example Live Demoimport java.util.Scanner; import java.util.regex.MatchResult; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Example { public static void main( String args[] ) { String regex = "(.*)(\d+)(.*)"; //Reading input ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
60 Views
The java.util.regex.MatcheResult interface provides methods to retrieve the results of a match.You can get an object of this interface using the toMatchResult() method of the Matcher class. This method returns a MatchResult object which represents the match state of the current matcher.The start() method of this interface returns the beginning index of the current match.Example Live Demoimport java.util.Scanner; import java.util.regex.MatchResult; import java.util.regex.Matcher; import java.util.regex.Pattern; public class StartExample { public static void main(String args[]) { //Reading String from user System.out.println("Enter a String"); Scanner sc = new Scanner(System.in); String input = ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
300 Views
This character class \p{javaMirrored} matches upper case letters. This class matches the characters which returns true when passed as a parameter to the isMirrored() method of the java.lang.Character class.Example 1 Live Demoimport java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegexExample { public static void main(String args[]) { //Reading String from user System.out.println("Enter a string"); Scanner sc = new Scanner(System.in); String input = sc.nextLine(); //Regular expression String regex = "[\p{javaMirrored}]"; //Compiling the regular expression Pattern pattern = ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
323 Views
This character class \p{javaWhitespace} matches spaces. This class matches the characters which returns true when passed as a parameter to the isWhitespace() method of the java.lang.Character class.Example 1 Live Demoimport java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegexExample { public static void main(String args[]) { //Reading String from user System.out.println("Enter a string"); Scanner sc = new Scanner(System.in); String input = sc.nextLine(); //Regular expression String regex = "[\p{javaWhitespace}]"; //Compiling the regular expression Pattern pattern = Pattern.compile(regex); ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
513 Views
This character class \p{javaUpperCase} matches upper case letters. This class matches the characters which returns true when passed as a parameter to the isUpperCase() method of the java.lang.Character class.Example 1 Live Demoimport java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegexExample { public static void main(String args[]) { //Reading String from user System.out.println("Enter a string"); Scanner sc = new Scanner(System.in); String input = sc.nextLine(); //Regular expression String regex = "[\p{javaUpperCase}]"; //Compiling the regular expression Pattern pattern = ... Read More
![Mahesh Parahar](https://www.tutorialspoint.com/assets/profiles/127878/profile/60_2277600-1655382864.jpg)
9K+ Views
Along with various other keywords Java also provides this and super as special keywords which primarily used to represent current instance of a class and it's super class respectively. With this similarity both these keywords have significant differences between them which are listed as below - Sr. No.Keythissuper1Represent and Referencethis keyword mainly represents the current instance of a class.On other hand super keyword represents the current instance of a parent class.2Interaction with class constructorthis keyword used to call default constructor of the same class.super keyword used to call default constructor of the parent class.3Method accessibilitythis keyword used to access methods of ... Read More
![Mahesh Parahar](https://www.tutorialspoint.com/assets/profiles/127878/profile/60_2277600-1655382864.jpg)
782 Views
In Java as we know that Collections are one of most important concept which makes Java as a powerful language in itself. It is only support of collections in Java which make it to support any type of data in a convenient and efficient way along with possible CRUD operations over them.But on same phase when collections get exposed to the multi-threading its performance get somewhat degraded because of somewhere collections lack the support to multi-threading environment. To overcome this limitation Java introduces Concurrent Collections which not only overcome the multi-threading environment limitation but also enhances the Java to perform ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
387 Views
This character class \p{javaLowerCase} matches lower case letters. This class matches the characters which returns true when passed as a parameter to the isLowerCase() method of the java.lang.Character class.Example 1 Live Demoimport java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegexExample { public static void main(String args[]) { //Reading String from user System.out.println("Enter a string"); Scanner sc = new Scanner(System.in); String input = sc.nextLine(); //Regular expression String regex = "[\p{javaLowerCase}]"; //Compiling the regular expression Pattern pattern = ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
360 Views
This class matches white space characters. i.e. \t, , \x, 0B, \f, \r.Example 1 Live Demoimport java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class SpaceCharacters { public static void main(String args[]) { //Reading String from user System.out.println("Enter a string"); Scanner sc = new Scanner(System.in); String input = sc.nextLine(); //Regular expression String regex = "[\p{Space}]"; //Compiling the regular expression Pattern pattern = Pattern.compile(regex); //Retrieving the matcher object Matcher matcher = pattern.matcher(input); ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
233 Views
This class matches hexa-decimal characters i.e. [0-9a-fA-F].Example 1 Live Demoimport java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class SpaceCharacters { public static void main(String args[]) { //Reading String from user System.out.println("Enter a string"); Scanner sc = new Scanner(System.in); String input = sc.nextLine(); //Regular expression String regex = "[\p{XDigit}]"; //Compiling the regular expression Pattern pattern = Pattern.compile(regex); //Retrieving the matcher object Matcher matcher = pattern.matcher(input); int count = 0; ... Read More