Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I'm getting wrong String value

Tags:

java

void displayId(PrintWriter stdOut, StringResources resources, IPatchBundle group, String[] ids){


        for(int i=0;i<ids.length;i++)
                System.out.println("Mids from cmdMds"+ids);
}

The above code produces [Ljava.lang.String;@152cf21. I tried putting .toString() too, still getting the same. Please help me to get the actual value.

like image 298
sahana Avatar asked Aug 26 '26 20:08

sahana


1 Answers

Change

System.out.println("Mids from cmdMds"+ids); 

To

System.out.println("Mids from cmdMds"+ids[i]); 

You're trying to print the whole array each time, not the individual elements.

like image 109
forsvarir Avatar answered Aug 28 '26 12:08

forsvarir



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!