Few Tricky Programs in Java Last Updated : 25 Sep, 2017 Summarize Comments Improve Suggest changes Share Like Article Like Report Comments that execute : Till now, we were always taught "Comments do not Execute". Let us see today "The comments that execute" Following is the code snippet: Java public class Testing { public static void main(String[] args) { // the line below this gives an output // \u000d System.out.println("comment executed"); } } Output: comment executed The reason for this is that the Java compiler parses the unicode character \u000d as a new line and gets transformed into: Java public class Testing { public static void main(String[] args) { // the line below this gives an output // \u000d System.out.println("comment executed"); } } Named loops : Java // A Java program to demonstrate working of named loops. public class Testing { public static void main(String[] args) { loop1: for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { if (i == 3) break loop1; System.out.println("i = " + i + " j = " + j); } } } } Output: i = 0 j = 0 i = 0 j = 1 i = 0 j = 2 i = 0 j = 3 i = 0 j = 4 i = 1 j = 0 i = 1 j = 1 i = 1 j = 2 i = 1 j = 3 i = 1 j = 4 i = 2 j = 0 i = 2 j = 1 i = 2 j = 2 i = 2 j = 3 i = 2 j = 4 You can also use continue to jump to start of the named loop. We can also use break (or continue) in a nested if-else with for loops in order to break several loops with if-else, so one can avoid setting lot of flags and testing them in the if-else in order to continue or not in this nested level. Comment More infoAdvertise with us Next Article Few Tricky Programs in Java K kartik Improve Article Tags : Java Technical Scripter java-puzzle Practice Tags : Java Similar Reads How to Run Java Program? Java is a popular, high-level, object-oriented programming language that was developed by James Gosling and his team at Sun Microsystems (now owned by Oracle Corporation) in the mid-1990s. It is widely used for developing various kinds of software, including web applications, desktop applications, m 2 min read Java Hello World Program Java is one of the most popular and widely used programming languages and platforms. In this article, we will learn how to write a simple Java Program. This article will guide you on how to write, compile, and run your first Java program. With the help of Java, we can develop web and mobile applicat 6 min read Java Programming Basics Java is one of the most popular and widely used programming language and platform. A platform is an environment that helps to develop and run programs written in any programming language. Java is fast, reliable and secure. From desktop to web applications, scientific supercomputers to gaming console 4 min read Java Date-Time Programs : Basic to Advanced Date and time are important aspects of many programs, such as calendars, schedulers, timers, clocks, etc. Java provides different classes and packages to handle date and time in various ways. One of the packages that Java offers is java.time, which was introduced in Java 8. This package contains man 3 min read Output of Java programs | Set 29 Question 1. What is the output of the following question? JAVA class Test1 { public static void main(String[] args) { int String = 65; int Runnable = 97; System.out.print(String + " : " + Runnable); } } Option A) Error B) A : a C) 65 : 97 D) None Output: C Explanation : We can use all pred 2 min read Like