How to run springboot service from command line
First, go to the project root directory where pom.xml file is present. And run the below command If the jar file is created, use the below command to run your springboot service on a specific port
How to create a set from list in java
We simply need to pass the list into the constructor of HashSet. It will remove all the duplicates from the list. If we want to maintain the same order of elements as list, then we should use LinkedHashSet class instead of HashSet.
How to refer external JDK in Eclipse/STS
In the Java Build Path screen, select ‘Modulepath’ and click on ‘Add Library’ On the next screen, select JRE System Library as shown below On the next screen, select ‘Alternate JRE’ and click on ‘Installed JRE’ On the next screen, click on ‘Add’ button On the next screen, by default ‘Standard VM’ would come. Let …
How to check and change current java version in your project in eclipse
1 – Expand the java project. It shows the current version of your java project 2 – Let’s assume, we want to update this to java version 1.8 Right click on your project, select ‘Build Path’ and then ‘Configure Build Path’ 3 – Then click on the ‘Libraries’ tab 4 – Then select ‘JRE System …
How to check and change current java version in your project in eclipseRead More
Reverse a String using Recursion
Recursion is a technique in which a method keeps on making calls to itself until some break condition occurs. We can use this technique in the scenarios where we have to perform similar task repeatedly for a certain number of times. In this post, we will use recursion technique to reverse a string. This is …
How to check java is strictly pass-by-value
Java is strictly pass-by-value. Meaning when we call a method, instead of the actual reference variable, a copy of it is sent to the method. Let’s consider below example You can be ascertain that the original value of variable val is still unaffected. This happens because local variable val in the method manipulateValue is a …
Different ways to create objects in java
There are several ways in which we can create java objects. In this post, we will have a look at some of these. 1. Using new keyword We have used this approach mostly to create objects in java. This is the most common and basic way. In this way, we call constructor with parameters or …