Some days age, I mistakenly pasted a URL in my Java program in a hurry, I attempted to run that specific program and in my curiosity, it ran successfully with no warnings, no errors and no exceptions. The similar code is as shown below. I compiles and runs successfully.
final public class Main
{
public static void main(String[] args)
{
System.out.println ("A curiosity");
https://localhost:8181/OnlineShoppingCartSystem-war/Restricted/Home
System.out.println ("compiled Ok!");
}
}
At the second line within the main() method, it should issue some compile-time errors but it works well and displays the respective messages on the console. Why?
The tokens
https:gets interpreted as a label. And the//that follows starts a new-line comment. So, the posted code continues to be valid Java (if you notice the syntax coloring).