Помогите разобраться с Scanner | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Помогите разобраться с Scanner

Объясните как ним пользоваться и как создать программу которая пишет суму двох чисел вводимых из клавиатуры

27th Oct 2017, 3:30 PM
Pasha Andrushchuk
Pasha Andrushchuk - avatar
1 Antwort
0
import java.util.Scanner; public class Summ { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Input first integer number >>>"); int firstInt = sc.nextInt(); System.out.print("Input second integer number >>>"); int secondInt = sc.nextInt(); System.out.println(firstInt + " + " + secondInt + " = " + (firstInt + secondInt)); } }
27th Oct 2017, 8:40 PM
Eugene Fedorov
Eugene Fedorov - avatar