diff --git a/core-java-modules/core-java/src/main/java/com/baeldung/javadoc/CodeSnippetFormatting.java b/core-java-modules/core-java/src/main/java/com/baeldung/javadoc/CodeSnippetFormatting.java new file mode 100644 index 0000000000..2bb9614e66 --- /dev/null +++ b/core-java-modules/core-java/src/main/java/com/baeldung/javadoc/CodeSnippetFormatting.java @@ -0,0 +1,154 @@ +package com.baeldung.javadoc; + +public class CodeSnippetFormatting { + + /** + * This is an example to show default behavior of code snippet formatting in Javadocs + * + * public class Application(){ + * + * } + * + */ + public void showCodeSnippetFormatting() { + // do nothing + } + + /** + * This is an example to show usage of HTML pre tag while code snippet formatting in Javadocs + * + *
+ * public class Application(){
+ * List nums = new ArrayList<>();
+ * }
+ *
+ *
+ */
+ public void showCodeSnippetFormattingUsingPRETag() {
+ // do nothing
+ }
+
+ /**
+ * This is an example to show usage of HTML character entities while code snippet formatting in Javadocs
+ *
+ *
+ * public class Application(){
+ * List<Integer> nums = new ArrayList<>();
+ * }
+ *
+ *
+ */
+ public void showCodeSnippetFormattingUsingCharacterEntities() {
+ // do nothing
+ }
+
+ /**
+ * This is an example to show usage of javadoc code tag while code snippet formatting in Javadocs
+ *
+ *
+ *
+ * public class Application(){
+ * {@code List nums = new ArrayList<>(); }
+ * }
+ *
+ *
+ */
+ public void showCodeSnippetFormattingUsingCodeTag() {
+ // do nothing
+ }
+
+ /**
+ * This is an example to show issue faced while using annotations in Javadocs
+ *
+ *
+ *
+ * public class Application(){
+ * @Getter
+ * {@code List nums = new ArrayList<>(); }
+ * }
+ *
+ *
+ */
+ public void showCodeSnippetFormattingIssueUsingCodeTag() {
+ // do nothing
+ }
+
+ /**
+ * This is an example to show usage of javadoc code tag for handling '@' character
+ *
+ *
+ *
+ * public class Application(){
+ * {@code @Getter}
+ * {@code List nums = new ArrayList<>(); }
+ * }
+ *
+ *
+ */
+ public void showCodeSnippetAnnotationFormattingUsingCodeTag() {
+ // do nothing
+ }
+
+
+ /**
+ * This is an example to show difference in javadoc literal and code tag
+ *
+ *
+ *
+ * {@literal @Getter}
+ * {@literal List
+ * {@code @Getter}
+ * {@code List
+ * {@code }
+ *
+ */
+ public void showJSCodeSnippetUsingJavadoc() {
+ // do nothing
+ }
+
+ /**
+ * This is an example to illustrate an HTML code snippet embedded in documentation comments
+ * {@code
+ *
+ *
+ * Hello World!
+ *
+ * }
+ *
+ *
+ */
+ public void showHTMLCodeSnippetUsingJavadoc() {
+ // do nothing
+ }
+
+ /**
+ * This is an example to illustrate an HTML code snippet embedded in documentation comments
+ * + * + * + *+ * + */ + public void showHTMLCodeSnippetIssueUsingJavadoc() { + // do nothing + } + +}Hello World!
+ * + * + *