'Assigning Variable name as function parameter java

I want to make new variable

String x = new String();

Note that I want "x" to be replaced with a function parameter as follows -->

void function(String desiredName){
     String desiredName = "bbb";
}

To make it simple I just need to make a variable with the same name of a function input.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source