how to make scanner static code example
Example: static scanner java
import java.util.Scanner;
class ComputerScienceHomework16 {
// making it static in other functions
static Scanner scanner = new Scanner(System.in);
public static void test(){
System.out.print("type a number: ");
int num = scanner.nextInt();
System.out.println("you typed the number " + num);
}
public static void main(String[] args) {
test()
}
}