Reputation: 31
import static java.lang.System.out;
import java.util.Scanner;
public class alphabets {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
out.print("Which verse?");
int verse = keyboard.nextInt();
switch (verse) {
case 1:
out.println("AAAA");
break;
case 2:
out.println("BBBBBB");
break;
case 3:
out.println("CCCCC");
break;
case 4:
out.println("DDDD");
break;
default:
out.println("No such verse");
break;
}
out.println("The Alphabet.");
}
}
Every time I "save as" the import java.util.Scanner; is deleted. And obviously after this the program will not run because the deleted import is missing. I have tried Preferences> Editor> Save Actions> Configure> Remove Unnecessary Casts. This doesn't work (though I am not sure this is what I should do). Any guidance would be wonderful. Thanks.
Upvotes: 3
Views: 1327
Reputation: 10727
Uncheck "Organize imports" from Save Actions. But I'm afraid that if the import is deleted, it's because you don't have that class on your classpath. So, you'll have to check that as well.
Upvotes: 3