JAVA
public class Main {
public static void main(String[] args) {
int x = 5;
--x;
System.out.println(x);
}
}
Explanation :
This Java program demonstrates the use of the decrement operator (--) to decrease the value of a variable.
Here is a step-by-step breakdown:
int x = 5;Declares an integer variable named
xand initializes it with the value5.--x;Applies the pre-decrement operator to
x. This subtracts1directly from the current value ofx.Since
xwas5, it now becomes4. (Because it is placed before the variable, it decrements the value immediately).System.out.println(x);Prints the current value of
x(4) to the console.
Output
4
SQL
SELECT Example Without DISTINCT
If you omit the DISTINCT keyword, the SQL statement returns the "Country" value from all the records of the "Customers" table:
Example
SELECT Country FROM Customers;
References :
https://www.w3schools.com/sql/sql_distinct.asp
https://www.w3schools.com/java/java_examples.asp
Top comments (0)