String methods - valueOf

I need to use the valueOf method to return a string representation of a boolean arguement but I don't know how to use this method.

Here is my code at the moment, if the inputted file name ends with .txt then 'true' is returned, if not then 'false' is returned.
So i want to return a string instead of true and false using this method.

I need to use the valueOf method to return a string representation of a boolean arguement but I don't know how to use this method.

Here is my code at the moment, if the inputted file name ends with .txt then 'true' is returned, if not then 'false' is returned.
So i want to return a string instead of true and false using this method.

Hi here is how you can do it. I have just used BufferedReader instead of Scanner.