Real World Example

Java Behind Everyday Apps

When you order food on Swiggy or pay with Paytm, the app on your phone talks to backend servers. Many of these servers are Java programs (usually Spring Boot) running on JVMs in the cloud. The same .jar file is built once and deployed to hundreds of Linux servers: that is "write once, run anywhere" in action.

Mobile app  --HTTP-->  Java backend (Spring Boot on JVM)  --SQL-->  Database
                         |  same order-service.jar runs on
                         |  100s of Linux servers / containers

A Tiny Order Summary Program

Example

Even a large backend is built from simple statements like these. This program prints an order confirmation, the kind of text a food delivery app sends you.

public class Main {
    public static void main(String[] args) {
        String restaurant = "Paradise Biryani";
        int items = 2;
        double amount = 549.0;
        System.out.println("Order confirmed!");
        System.out.println("Restaurant : " + restaurant);
        System.out.println("Items      : " + items);
        System.out.println("Amount     : Rs. " + amount);
        System.out.println("Estimated delivery in 35 minutes.");
    }
}

Output

Order confirmed!
Restaurant : Paradise Biryani
Items      : 2
Amount     : Rs. 549.0
Estimated delivery in 35 minutes.