Java Code Samples


Deduplicate a string in java
harika | 5 years, 7 months
import java.util.HashMap;
public class DeduplicationOfString{
        static String dedup(String i
java string
8080 port already taken issue when trying to redeploy project from Spring Tool Suite IDE
ashokrebel007 | 5 years, 2 months
Open CMD with Administrator

1. Check what processes are running at available ports
If you want do this one you should open the CMD with Administrator only.
While opening eclipse getting java virtual machine not found error
srija | 4 years, 8 months
First we have to check is java successfully installed or not check using below command
java -versio
java eclipse
How to read a file from nth line onwards in java?
Reshma | 4 years, 4 months
reading nth line onwards java
Read Using the Environment
Reshma | 4 years, 7 months
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.
Here, we are using @Autowired annotation to inject the environment object into our RestController ,
java environment
Reading with @Value Annotation
Reshma | 4 years, 7 months
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.fac java @value
Reading application.Properties with @ConfigurationProperties
Reshma | 4 years, 7 months

To use we have to create a Controller or Service class.In order to include it we java @configurationproperties
Comments executed
Reshma | 4 years, 9 months
public class Testing { 
    public static void main(String[] args) 
The reason for this is that the Java compiler parses the unicode character \u000d as a new line and
java comments
Finding anagram
itulasi | 4 years, 8 months
import java.util.Arrays;

public class StringAnagram {
Anagram of the string is a string contains the same characters. But order of the characters may be d
java string anagram
Overloading In Java
Reshma | 4 years, 9 months
public class Sum
    public int sum(int x, int y) 
java overloading