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 increment operator (++) to increase 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-increment operator to
x. This adds1directly to the current value ofx.Since
xwas5, it now becomes6. (Because it is placed before the variable, it increments the value immediately before using it).System.out.println(x);Prints the current value of
x(6) to the console.
Output
6
SQL
SQL SELECT DISTINCT Statement
The SELECT DISTINCT statement is used to return only distinct (unique) values.
In a table, a column may contain several duplicate values - and sometimes you want to list only the unique values.
Example
Select all the distinct (unique) countries from the "Customers" table:
SELECT DISTINCT Country FROM Customers;
SELECT DISTINCT Syntax
SELECT DISTINCT column1, column2, ...
FROM table_name;
References :
https://www.w3schools.com/sql/sql_distinct.asp
https://www.w3schools.com/java/java_examples.asp
Top comments (0)