0% found this document useful (0 votes)
8 views2 pages

Java Intro Arithmetic Lesson

This lesson teaches basic arithmetic operations in Java, including addition, subtraction, multiplication, and division, through clear code examples. It is suitable for beginners and can be used as classroom reference material. Suggestions for extending the lesson include user input, handling decimal numbers, and implementing error handling for division by zero.

Uploaded by

Ramya Sajeeth
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Java Intro Arithmetic Lesson

This lesson teaches basic arithmetic operations in Java, including addition, subtraction, multiplication, and division, through clear code examples. It is suitable for beginners and can be used as classroom reference material. Suggestions for extending the lesson include user input, handling decimal numbers, and implementing error handling for division by zero.

Uploaded by

Ramya Sajeeth
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Overview

This lesson explains how to perform basic arithmetic operations using Java programming. It
introduces addition, subtraction, multiplication, and division through simple, well-
commented code examples. This is ideal for beginners or as classroom reference material.

Java Program Code


java
CopyEdit
public class ArithmeticOperations {
public static void main(String[] args) {
int a = 20, b = 10;

// Addition
int sum = a + b;
System.out.println("Sum = " + sum);

// Subtraction
int diff = a - b;
System.out.println("Difference = " + diff);

// Multiplication
int product = a * b;
System.out.println("Product = " + product);

// Division
int quotient = a / b;
System.out.println("Quotient = " + quotient);
}
}

Sample Output
ini
CopyEdit
Sum = 30
Difference = 10
Product = 200
Quotient = 2

Educational Use

This Java lesson is valuable for classroom teaching or self-study. It reinforces the use of
variables and operators in Java while also building logical thinking.

Ideas for Extension:

 Accept input from the user using Scanner


 Handle decimal numbers using float or double
 Include error-handling for division by zero

You might also like