DEV Community

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

Posted on

One Commit at a Time ! Series - 16

JAVA

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

Explanation :

This Java program can be thought of as a simple automated greeting machine at a storefront or a digital receptionist:

  • public class Main: Imagine this is the entire building or office named "Main". Every Java program requires at least one building where everything takes place.
  • public static void main(String[] args): This is the front desk manager or the main entrance doors. When you start the program, the computer looks specifically for this manager to know where to begin work. Without it, nobody is at the front desk to kick things off.
  • String greeting = "Hello";: The receptionist grabs a sticky note and writes down the word "Hello", storing it in a file folder labeled greeting.
  • System.out.println(greeting);: The receptionist takes that sticky note and announces it over the loudspeaker (System.out), printing the text onto your computer screen for everyone to see.

SQL

Order Alphabetically
For string values, the ORDER BY keyword will sort the values in the column alphabetically:

Example
Sort the ProductName column in alphabetically order:

SELECT * FROM Products
ORDER BY ProductName;
Enter fullscreen mode Exit fullscreen mode

Alphabetically DESC
To sort the text values in a column in a descending order, use the DESC keyword:

Example
Sort the ProductName column in descending alphabetically order:

SELECT * FROM Products
ORDER BY ProductName DESC;
Enter fullscreen mode Exit fullscreen mode

References :

https://www.w3schools.com/sql/sql_orderby.asp
https://www.w3schools.com/java/tryjava.asp?filename=demo_strings

Top comments (0)