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 used to C/C++ and I'm wondering if I can define something like
#define READINT Scanner(System.in).nextInt();
and then, in every place in my java program I can read form console as
int a = new READINT;
But I read form books Java does not support macros.
Someone please explain me why is it so, and can I do this in any other way.