JAVA

class Main { public static void main(String[] args) { int [] numbers = {1, 2, 3, 4, 5, 6}; int [] positiveNumbers = numbers; // copying arrays // change value of first array numbers[0] = -1; // printing the second array for (int number: positiveNumbers) { System.out.print(number + ", "); } } } 

Explanations

  • class Main {: Declares a public class named Main to serve as the structural framework for the application.
  • public static void main(String[] args) {: The entry point method where the Java Virtual Machine begins execution.
  • int [] numbers = {1, 2, 3, 4, 5, 6};: Declares and initializes an integer array named numbers containing six elements in memory.
  • int [] positiveNumbers = numbers;: Copies the reference (memory address) of the numbers array into a new array reference variable named positiveNumbers. This does not duplicate the underlying array data; both variables now point to the exact same array object in memory.
  • numbers[0] = -1;: Modifies the first element (index 0) of the array to -1. Because both numbers and positiveNumbers point to the same array object, this change will also be reflected when accessing the array through positiveNumbers.
  • for (int number: positiveNumbers) {: Starts an enhanced for-loop to iterate through each element stored in the positiveNumbers array reference.
  • System.out.print(number + ", ");: Prints each element of the array followed by a comma and a space on the same line (resulting in output where the first item is -1 instead of 1).
  • }: Closes the loop block.
  • }: Closes the main method block.
  • }: Closes the Main class block.

SQL

IN Operator

The IN operator is used in the WHERE clause to check if a specified column's value matches any value within a provided list.

The IN operator functions as a shorthand for multiple OR conditions, making queries shorter and more readable.

Syntax :
SELECT column_name(s)
FROM table_name
WHERE column_name IN (value1, value2, ...);

SELECT * FROM Customers WHERE Country IN ('Germany', 'France', 'UK'); 

Reference :
https://www.w3schools.com/sql/sql_in.asp
https://www.programiz.com/java-programming/copy-arrays