Question 06:
Why Scanner class is used? Use Scanner class to read student names
in an array of size 10 and then display the names of those students
which contains word “Rehman” in their names.??
Answer:
In Java, Scanner is a class in java.util package used for obtaining the input of the primitive types like int, double, etc. and strings. Using the Scanner class in Java is the easiest way to read input in a Java program, though not very efficient if you want an input method for scenarios where time is a constraint like in competitive programming.
Code:
Output:
![]() |
java exercise solution 6 |
0 Response to "06 Solution Java Exercise"
Post a Comment