Reputation: 853
I want to print the String Array. This is my Code:
System.out.println(WMSLoggerFactory.getGlobalLogValue(WMSLoggerIDs.FD_ALL));
I got this error:
The method getGlobalLogValue(String) in the type WMSLoggerFactory is not applicable for the arguments (String[])
How can I print this?
Upvotes: 0
Views: 2583
Reputation: 103777
I don't know what a WMSLoggerFactory
is, but I suspect it's going to want a String. One simple way to convert an Array into a sensible looking string is the Arrays.toString
method, which will create a string that looks something like
["foo", "bar", "bletch"]
In this case, you could call it as
System.out.println(WMSLoggerFactory.getGlobalLogValue(Arrays.toString(WMSLoggerIDs.FD_ALL)));
That said, I don't think your question is particularly clear. Judging by that method name, it's going to want some sort of key, not a string representation of an array. What exactly are you trying to print out, and why do you need the WMSLoggerFactory
to do this?
Upvotes: 1
Reputation: 63688
Use for loop:
for(String s : WMSLoggerIDs.FD_ALL) {
System.out.println(WMSLoggerFactory.getGlobalLogValue(s));
}
Upvotes: 3