DEV Community

Cover image for One Commit at a Time ! Series - 25
Annapoorani Kadhiravan
Annapoorani Kadhiravan

Posted on

One Commit at a Time ! Series - 25

JAVA

public class Main {
  public static void main(String[] args) {
    int x = 5;
    System.out.println(x);
  }
}
Enter fullscreen mode Exit fullscreen mode

Explanation :

1. The Class Definition

public class Main {

Enter fullscreen mode Exit fullscreen mode
  • public class Main: In Java, every program must be enclosed in a class. This defines a public class named Main. By convention, the name of the main class usually matches the filename (Main.java).

2. The Main Method

  public static void main(String[] args) {

Enter fullscreen mode Exit fullscreen mode
  • public static void main(String[] args): This is the entry point of any standalone Java application. The Java runtime always looks for this exact method signature to start running the program.
  • public: Means this method can be accessed from outside the class.
  • static: Means the method belongs to the class itself, rather than an instance of the class, so Java can call it without creating an object.
  • void: Means this method does not return any value.
  • String[] args: This is an array that can store command-line arguments passed to the program.

3. Variable Declaration and Assignment

    int x = 5;

Enter fullscreen mode Exit fullscreen mode
  • int x = 5;: This declares a variable named x of type int (integer, meaning whole numbers) and assigns it the value 5.

4. Printing to the Console

    System.out.println(x);

Enter fullscreen mode Exit fullscreen mode
  • System.out.println(x);: This tells Java to print the value stored in the variable x to the console, followed by a new line.

Output

When you run this program, the console will display:

5

Enter fullscreen mode Exit fullscreen mode

SQL

The WHERE clause can contain one or many AND operators.

The AND operator is used to filter records based on more than one condition.

Note: The AND operator displays a record if all the conditions are TRUE.

The following SQL selects all customers from Spain that starts with the letter 'G':

Example

Select all customers where Country is "Spain" AND CustomerName starts with the letter 'G':
SELECT *
FROM Customers
WHERE Country = 'Spain' AND CustomerName LIKE 'G%';
Enter fullscreen mode Exit fullscreen mode

References :
https://www.w3schools.com/sql/sql_and.asp
https://www.w3schools.com/java/tryjava.asp?filename=demo_oper_ass1

Top comments (0)