The assignment operator (=) in Java is used to assign a value to a variable. In this case, x = 10 assigns the value 10 to the variable x.
public class AssignmentExample {
public static void main(String[] args) {
// Declare a variable
int x;
// Assign a value to the variable
x = 10;
// Display the value of x
System.out.println("The value of x is: " + x);
}
}
When you run this Java program, it will output "The value of x is: 10". This demonstrates the assignment of the value 10
to the variable x
.