Core java
11 Junepublic static void main(String[] args) – Java main method
If you have worked with Java programs before, you know that all Java programs start by running the main() method(public static void main(String[] args)). The main() method is the entry point. The signature of the main method is fixed, and each portion of the statement has significance. Why is the main method so important? The […]
02 JuneFind and count occurrences of substring in string in java
In this post, we will see how to find and count occurrences of substring in string in java. Using the indexOf() method The indexOf() method in java is a specialized function to find the index of the first occurrence of a substring in a string. This method has 4 overloads. [crayon-6a29d5f8ef70f943182823/] We will use the […]
23 MayPrint double quotes in java
💡 Outline You can print double quotes in java by escape double quotes using backslash character(\). [crayon-6a29d5f8f0a88921328345/] When you print on console using System.out.println, you use double quotes and whatever value inside double quotes is printed. But what if you want to actually print double quotes on console. In this tutorial, we will see different […]
20 MayQuestion mark operator in java
Learn about Question mark operator in java. It is also know as ternary operator.
12 MayJava Set to Array
In this post, we will learn java set to array conversion. There are many ways to convert set to an array. 1. Using Java 8’s Stream If you are using Java 8, I would recommend using Java 8 Stream. [crayon-6a29d5f9009bc020641305/] Output [John, Martin, Mary] 2. Using toArray() We can directly call toArray() method on set […]