Skip to content

Category Archives: Java Programs

In a graph with V vertices and E edges, the LIS (Largest Independent Set) is the set of all the vertices in the graph which… Read More
String Class stripLeading() method is used to strip leading whitespaces from the string i.e stripLeading() method removes all the whitespaces only at the starting of… Read More
The writeString() method of File Class in Java is used to write contents to the specified file. Syntax: Files.writeString(path, string, options) Parameters:  path – File… Read More
The readString() method of File Class in Java is used to read contents to the specified file. Syntax: Files.readString(filePath) Parameters:  path - File path with… Read More
In order to negate an existing predicate, the Predicate.not() static method added to Java 11. The Predicate class is present in java.util.function package. Syntax: negate = Predicate.not(… Read More
Pattern searching is a crucial problem in computer science. When we do search for a string in notepad/word file or browser or database, pattern searching… Read More
If we want to access Private Field and method using Reflection we just need to call setAccessible(true) on the field or method object which you… Read More
Enumerations serve the purpose of representing a group of named constants in a programming language. Enums are used when we know all possible values at… Read More
If we have the Date object of the SQL package, then we can easily convert it into an util Date object. We need to pass… Read More
Resources are the collections of files or images or stuff of other formats. Java programs help us to load these files or images of the… Read More
Line break (“\n”) is a single character, to replace all line breaks from strings replace() function can be used. String replace(): returns a new String… Read More
As we know that in a calendar year, there are a total of 12 Months. In order to convert the name of months to a… Read More
In a file system, without reading the previous text we cannot directly access the specific index. Thus, Reading text from a file from the specific… Read More
Stream Interface in Java API is present in Java.Util.Stream and is extending the BaseStream<T, Stream<T>> interface. This interface is created on any stream of objects… Read More
Chromatic Index of a graph is the minimum number of colours required to colour the edges of the graph such that any two edges that… Read More