Skip to content
Advertisement

Result of ‘File.createNewFile()’ is ignored

I’m not sure why this is but in my IDE, for file.createNewFile(); I’m getting Result of 'File.createNewFile()' is ignored for it which I’ve no idea what I should be doing

Advertisement

Answer

Static Code Inspection in your IDE for createNewFile might be complaining this because createNewFile returns a boolean value. This is in place so that you have a way to determine if the creation of file is successful or not and act accordingly. Right now the boolean result is not assigned to any variable, so it’s ignored.

Ideally you should check the result of file.createNewFile() and validate whether file actually got created before moving on to setting up connection.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement