Fendadis John has Published 81 Articles

How to find the subsequence in an input sequence that matches the pattern required in Java Regular Expressions?

Fendadis John

Fendadis John

Updated on 30-Jul-2019 22:30:24

327 Views

The find() method finds the subsequence in an input sequence that matches the pattern required. This method is available in the Matcher class that is available in the java.util.regex package.A program that demonstrates the method Matcher.find() in Java regular expressions is given as follows:Example Live Demoimport java.util.regex.Matcher; import java.util.regex.Pattern; public class ... Read More

Name validation using Java Regular Expressions

Fendadis John

Fendadis John

Updated on 30-Jul-2019 22:30:24

911 Views

The name can be validated using the java.util.regex.Pattern.matches() method. This method matches the regular expression for the name and the given input name and returns true if they match and false otherwise.A program that demonstrates this is given as follows:Example Live Demopublic class Demo {    public static void main(String args[]) ... Read More

Sorting collection of String and StringBuffer in Java

Fendadis John

Fendadis John

Updated on 30-Jul-2019 22:30:23

522 Views

In order to sort in Java as we know we can use either Comparable or Comparator interfaces in which we could also define our custom logic to sort.One of the approach to sort is to add the entity in TreeSet or TreeMap which would sort the entries as internally they ... Read More

Streams in Java

Fendadis John

Fendadis John

Updated on 30-Jul-2019 22:30:23

1K+ Views

Stream is a new abstract layer introduced in Java 8. Using stream, you can process data in a declarative way similar to SQL statements. For example, consider the following SQL statement. SELECT max(salary), employee_id, employee_name FROM Employee The above SQL expression automatically returns the maximum salaried employee's details, ... Read More

How to make an object eligible for garbage collection in Java?

Fendadis John

Fendadis John

Updated on 30-Jul-2019 22:30:23

124 Views

Java Garbage collector tracks the live object and objects which are no more need are marked for garbage collection. It relieves developers to think of memory allocation/deallocation issues. JVM uses the heap, for dynamic allocation. In most of the cases, the operating systems allocate the heap in advance which is ... Read More

Functional Interfaces in Java Programming

Fendadis John

Fendadis John

Updated on 30-Jul-2019 22:30:23

274 Views

Functional interfaces have a single functionality to exhibit. For example, a Comparable interface with a single method 'compareTo' is used for comparison purpose. Java 8 has defined a lot of functional interfaces to be used extensively in lambda expressions. Following is the list of functional interfaces defined in java.util.Function package. ... Read More

How do I view events fired on an element in Chrome?

Fendadis John

Fendadis John

Updated on 30-Jul-2019 22:30:22

12K+ Views

To view events fired on an element, follow the below steps in Google Chrome:Open Google Chrome and press F12 to open Dev Tools.Now go to Sources TabGo to Event Listener Breakpoints, on the right:Click on the events and interact with the target element.If the event will fire, then you will get ... Read More

What is the difference between cerr and clog streams in c++?

Fendadis John

Fendadis John

Updated on 30-Jul-2019 22:30:21

530 Views

cerr and clog are both objects of the stderr stream. Following are the differences between them. You can also read about the cout object to get a clearer picture.Un-buffered standard error stream (cerr)cerr is the standard error stream which is used to output the errors. This is also an instance ... Read More

Java Boolean operators

Fendadis John

Fendadis John

Updated on 30-Jul-2019 22:30:21

8K+ Views

There are following boolean operators supported by Java language.Assume variable A holds 10 and variable B holds 20, then −OperatorDescriptionExample== (equal to)Checks if the values of two operands are equal or not, if yes then condition becomes true.(A == B) is not true.!= (not equal to)Checks if the values of ... Read More

History of C++ language

Fendadis John

Fendadis John

Updated on 30-Jul-2019 22:30:21

2K+ Views

The C++ programming language has a history going back to 1979, when Bjarne Stroustrup was doing work for his Ph.D. thesis. He began work on "C with Classes", which as the name implies was meant to be a superset of the C language. His goal was to add object-oriented programming ... Read More

Advertisements