Java Examples

100+ tutorials, source code, and examples to help you develop creative and technical skills.

Java Program to use Arithmetic Operators

ArithmeticOperators .java

/* Code From Learnoset - Learn Code Online Android App.*/
/*Download Learnoset App from PlayStore to learn coding*/

//Java Program to use Arithmetic Operators in java

class ArithmeticOperators {
  public static void main(String[] args) {
    
    // declare variables
    int a = 12, b = 5;

    // addition operator
    System.out.println("a + b = " + (a + b));

    // subtraction operator
    System.out.println("a - b = " + (a - b));

    // multiplication operator
    System.out.println("a * b = " + (a * b));

    // division operator
    System.out.println("a / b = " + (a / b));

    // modulo operator
    System.out.println("a % b = " + (a % b));
  }
}

/*----------OUTPUT----------
a + b = 17
a - b = 7 
a * b = 60
a / b = 2 
a % b = 2 
*/

Projects with Source Code + Video Tutorials

You can download our Java and Android Studio Projects with Source Code and Video Tutorials.

QR-Code-Scanner-and-Generator-Application-for-Android
QR Code Scanner and Generator Application for Android
How-to-create-custom-Update-Dialog-with-Example-in-Android-Studio
How to create custom Update Dialog with Example in Android Studio
Complete-Chat-Application-Using-Firebase-Database
Complete Chat Application Using Firebase Database

If you have any Questions or Queries
You can mail us at info.learnoset@gmail.com

Follow us to learn Coding and get in touch with new Technologies.