How to use 'scanner' in JAVA?
Why do we need Scanner class in order to input something?
Fundamentally misunderstanding Java Scanner class.
A small rant regarding the Scanner class...
Q1. What is the Scanner class in Java?
Q5. What is the use of a Scanner?
Q3. How to write a Scanner class?
I have to learn how to code in JAVA for school, I have been trying for many hours now but I fail to understand how to to use 'Scanner'
Could anybody help me out with this code to at least teach me how I can use it right the next time? Because the answers to my mistakes is nowhere to be found even after watching countless of Youtube videos.
I have to change the code so that the number will get printed.
Sample input1: 12 > The sample output for this has to be also: 12
Sample input 2: 42 > The sample output for this also has to be: 42
Sample imput 3: -12 > The sample output for this also has to be: -12
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = New Scanner(System.in);
int getal = scanner.nextInt();
System.out.println(........)
And then I honestly have no clue what to do..
Please help and thank you in advance