+ 2
When I write string name, it shows that local variable value not used even if I give it a value.
6 Answers
+ 3
I think you are confused with class variable and method variable, it will be good idea if you show us your code.
+ 2
Not use is different from uninitialized, try to display it or something
+ 2
I wrote
{
class siloniya
public static void main(String[ ] args){
String name ="Rahul";
}
}
+ 2
And when I wrote this it said, "local variable is not used."
+ 2
yes it is local variable inside the main method , its just a warning and not an error, it warns you that you declared a variable but never used it.
+ 2
But when I run it, it doesn't output anything.