In this video, you will learn how to add two numbers in Java using user input.
Topics covered:
Variables in Java
Taking input using Scanner
Performing addition
Printing output
Program:
import java.util.Scanner;
public class AddNumbers {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter first number:");
int a = sc.nextInt();
System.out.println("Enter second number:");
int b = sc.nextInt();
int sum = a + b;
System.out.println("Sum = " + sum);
}
}
🚀 Java Full Course Playlist:
• Java programming
#Java #JavaProgramming #Scanner #CodingForBeginners
On this page of the site you can watch the video online Add Two Numbers in Java 🔥 | User Input + Scanner Explained with a duration of hours minute second in good quality, which was uploaded by the user CodingwithFazil 16 April 2026, share the link with friends and acquaintances, this video has already been watched 50 times on youtube and it was liked by 0 viewers. Enjoy your viewing!