From a46ced552ad273b7c0b69cb5e68d30b51e33962c Mon Sep 17 00:00:00 2001 From: Anton Haubner Date: Tue, 26 Sep 2023 15:20:29 +0200 Subject: [PATCH] Modify rule S6466: Fix code examples --- rules/S6466/java/rule.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rules/S6466/java/rule.adoc b/rules/S6466/java/rule.adoc index fc2b0270f19..5aaa739b0ee 100644 --- a/rules/S6466/java/rule.adoc +++ b/rules/S6466/java/rule.adoc @@ -62,7 +62,7 @@ Still, accessing an array with its size as an index is not correct: [source,java,diff-id=2,diff-type=noncompliant] ---- void nonCompliant(int[] arr) { - System.out.println(arr[arr.length]); # Noncompliant: Indexing starts at 0, hence array.length will always be an invalid index. + System.out.println(arr[arr.length]); // Noncompliant: Indexing starts at 0, hence array.length will always be an invalid index. } ---- @@ -71,8 +71,8 @@ Still, accessing an array with its size as an index is not correct: [source,java,diff-id=2,diff-type=compliant] ---- void compliant(int[] arr) { - # We can make sure arr is non-empty before trying to access its last element. - if (array.length > 0) { + // We can make sure arr is non-empty before trying to access its last element. + if (arr.length > 0) { System.out.println(arr[arr.length - 1]); } else { System.out.println("Empty array!");