JAVA

# Create objects inside the same class class Lamp { // stores the value for light // true if light is on // false if light is off boolean isOn; // method to turn on the light void turnOn() { isOn = true; System.out.println("Light on? " + isOn); } public static void main(String[] args) { // create an object of Lamp Lamp led = new Lamp(); // access method using object led.turnOn(); } } OUTPUT : Light on? true 

SQL

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.

SELECT DISTINCT Syntax
SELECT DISTINCT column1, column2, ...
FROM table_name;

SELECT DISTINCT Country FROM Customers; 

Count Distinct Values
By using the COUNT() function with the DISTINCT keyword, we can count the number of unique countries.

SELECT COUNT(DISTINCT Country) FROM Customers; 

References :
https://www.w3schools.com/sql/sql_distinct.asp
https://www.programiz.com/java-programming/class-objects