file – Usage of SuppressWarnings in java

I am working with Files in java and my IDE is VS-Code.The problem I am facing that it is showing the following as warnings alongwith a bunch of others-

Resource leak: 'sc' is never closed
Resource leak: 'scan' is never closed

where “sc” is defined as –

Scanner sc = new Scanner(System.in); 

and “scan” as –

File fobj=new File("Marks.txt");
Scanner scan = new Scanner(fobj);

I am asking that Using @SuppressWarnings("resources") only blocks warning from Scanner object sc.Is there any way to block all of these open resources warnings which can be defined at the beginning of the Java file because I have to include @SuppressWarnings(“resources”) in every class I write.