code is as follows:
import java.util.Scanner;
import com.sun.jmx.snmp.SnmpUnknownSubSystemException;
public class ForProject {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print(":");
int num = input.nextInt();
System.out.println(":");
for(int i=0 ;i <= num; iPP){
System.out.println(i +"\t"+ "+"+"\t"+ (num - i) +"\t" + "="+ "\t" + num );
}
}
}
the running result is no problem. The problem is that the eclipse always shows a yellow icon, and warns that: input is never closed
has looked it up on the Internet, saying that input has been consuming memory because it has not been closed.
the problem is that after adding close to the code, pop-up The method close () is undefined for the type Input
I want to ask what this is all about
code is as follows:
import java.util.Scanner;
import com.sun.corba.se.spi.orbutil.fsm.Input;
import com.sun.jmx.snmp.SnmpUnknownSubSystemException;
public class ForProject {
public static void main(String[] args) {
try{
Scanner input = new Scanner(System.in);
System.out.print(":");
int num = input.nextInt();
System.out.println(":");
for(int i=0 ;i <= num; iPP){
System.out.println(i +"\t"+ "+"+"\t"+ (num - i) +"\t" + "="+ "\t" + num );
}
}finally{
Input.close();
}
}
}
prompt: