# Java: Display and compute specified expressions

## Java Basic: Exercise-9 with Solution

Write a Java program to compute the specified expressions and print the output.

*Specified Expression :*

(25.5 * 3.5 - 3.5 * 3.5) / (40.5 - 4.5)

**Pictorial Presentation:**

**Sample Solution:**

**Java Code:**

```
public class Exercise9 {
public static void main(String[] arg) {
// Calculate and print the result of a mathematical expression
System.out.println((25.5 * 3.5 - 3.5 * 3.5) / (40.5 - 4.5));
}
}
```

**Explanation:**

The above Java code calculates and prints the result of the following mathematical expression:

(25.5 * 3.5 - 3.5 * 3.5) / (40.5 - 4.5)

The code performs arithmetic operations, including multiplication, subtraction, and division, and displays the final result. In this case, the result will be printed to the console.

Sample Output:

2.138888888888889

**Flowchart: **

**Java Code Editor:**

**Previous:** Write a Java program to display the specified pattern.

**Next:** Write a Java program to compute a specified formula.

**What is the difficulty level of this exercise?**

Test your Programming skills with w3resource's quiz.

**Weekly Trends**- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join