Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis+ 3
Any other way of initializing Scanner class
Traditionally we initialise scanner class like this: Scanner sc=new Scanner(System.in); Int a=sc.netInt(); I read in a book that it can be initialised by some other way. I have forgotten it now but it was something like this: int a=nextInt().new Scanner(System.in); I tried it but it gave me an error. Does somebody knows how to do it??
2 Respostas
+ 4
It could be
int a = new Scanner(System.in).nextInt()