URI uri = new URI("https://www.example.com/search?q=java&location=usa"); String rawQuery = uri.getRawQuery(); System.out.println(rawQuery); // Output: "q=java&location=usa"
URI uri = new URI("https://www.example.com/search"); String rawQuery = uri.getRawQuery(); System.out.println(rawQuery); // Output: null
URI uri = new URI("https://www.example.com/search?="); String rawQuery = uri.getRawQuery(); System.out.println(rawQuery); // Output: "="In this example, the URI has an empty query component. Package Library: java.net package is included in the Java Development Kit (JDK) standard edition.