Hi everyone, i am new to the forum. I am currently in the middle of an Oracle course and i am having an issue with one of my assignments.
It runs fine in Eclipse but not in the Cmd line. I have searched for days on how to fix the issue with no results so i am hoping that someone here may be kind enough to help me.
public class Calc {
public static void main(String[] args) {
Scanner items = new Scanner(System.in); // resource error occurs on this line "resource leak:'items' is never closed
double firstnumber, secondnumber, thirdnumber, answer;
System.out.println("Enter first number");
firstnumber = items.nextDouble();
System.out.println("Enter second number");
secondnumber = items.nextDouble();
System.out.println("Enter third number");
thirdnumber = items.nextDouble();
answer = firstnumber + secondnumber + thirdnumber;
System.out.println(answer);