In my program I\'m reading integers form console many times. Every time, I need to type this line.
new Scanner(System.in).nextInt();
I\'m
Java does not support macros. IIRC, the language designers felt that macros and the resultant preparser was an unnecessary and undesirable complication.
Use a function instead:
public int readInt(Scanner inp) {
return inp.nextint();
}
Elsewhere:
Scanner input=new Scanner(System.in);
...
int a=readInt(input);
Note also, that I create the scanner once and reuse it.