Java — Executable Comments | Code Factory

package com.example.java.programming;/**
* @author code.factory
*
*/
public class Test {
public static void main(String... strings) {
// The comment below is magic..
// \u000d System.out.println("Code Factory Comment Executed!");
}
}
Code Factory Comment Executed!
package com.example.java.programming;/**
* @author code.factory
*
*/
public class Test {
public static void main(String... strings) {
// The comment below is magic..
//
System.out.println("Code Factory Comment Executed!");
}
}
  1. Java source code can be written in any encoding which allows a wide range of characters in string, literal and comments.
  2. It makes processing by ASCII-based tools easier.
  3. This guarantees java Platform dependence which is the independence from supported character sets.
  4. This helps in documenting code in non-Latin languages.
\u0070\u0075\u0062\u006c\u0069\u0063\u0020\u0020\u0020\u0020 
\u0063\u006c\u0061\u0073\u0073\u0020\u0055\u0067\u006c\u0079
\u007b\u0070\u0075\u0062\u006c\u0069\u0063\u0020\u0020\u0020
\u0020\u0020\u0020\u0020\u0073\u0074\u0061\u0074\u0069\u0063
\u0076\u006f\u0069\u0064\u0020\u006d\u0061\u0069\u006e\u0028
\u0053\u0074\u0072\u0069\u006e\u0067\u005b\u005d\u0020\u0020
\u0020\u0020\u0020\u0020\u0061\u0072\u0067\u0073\u0029\u007b
\u0053\u0079\u0073\u0074\u0065\u006d\u002e\u006f\u0075\u0074
\u002e\u0070\u0072\u0069\u006e\u0074\u006c\u006e\u0028\u0020
\u0022\u0048\u0065\u006c\u006c\u006f\u0020\u0077\u0022\u002b
\u0022\u006f\u0072\u006c\u0064\u0022\u0029\u003b\u007d\u007d
Hello world

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Shorthand Control Expressions in Ruby

Etermax at Unite Copenhagen 19

Understanding High Availability & How to achieve it?

How Do You Prepare for Drupal 9?

How Do You Prepare for Drupal 9? 5 Tools to Detect any Uses of Deprecated Code on Your Drupal Website

Flattering oneself

A Drupal 8 DevOps-Based Workflow: Deliver Your Drupal Projects Faster, With No Compromise on…

A Drupal 8 DevOps-Based Workflow: Deliver Your Drupal Projects Faster, With No Compromise on Quality

Sql Server Backup to Network Share Map Script

Apache Airflow — Using PyCharm and Docker for remote debugging

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Code Factory

Code Factory

More from Medium

Local variables with “var” since Java 10

How-To Benchmarking in Java

Numbering System edge cases of Java

Java Character Streams: BufferedReader, InputStreamReader etc.