Sorry this look very childish question .But why my String value is not changing. my code is below
class Car{
public static void car(String name)
{
name="Bmw";
}
}
public static void main(String[] args) {
String name="honda";
Car.car(name);
System.out.println(name);
}
out put:-honda
I know java is pass by value . so i was thinking that honda
will become bmw
. Please give explaination on this.Thanks in advance!