0

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?

2 Answers 2

3

Use for loop:

for(String s : WMSLoggerIDs.FD_ALL) {
     System.out.println(WMSLoggerFactory.getGlobalLogValue(s));
}
Sign up to request clarification or add additional context in comments.

Comments

1

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?

1 Comment

i want to receive the all Log fields by using this method

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.