Datasets:
Download raw/java/cwe_1025_0_upgrade.java from amazon/AutoSUIT: direct link, hf CLI and curl.
- Browser
- Download file 722 Bytes
-
https://huggingface.co/datasets/amazon/AutoSUIT/resolve/main/raw/java/cwe_1025_0_upgrade.java
- Command line
-
hf download hf://datasets/amazon/AutoSUIT/raw/java/cwe_1025_0_upgrade.java
-
curl -L -o cwe_1025_0_upgrade.java https://huggingface.co/datasets/amazon/AutoSUIT/resolve/main/raw/java/cwe_1025_0_upgrade.java
722 Bytes
| class StringComparison { | |
| // Function to check if two strings are equal using 'equals' | |
| public static boolean areStringsEqual(String str1, String str2) { | |
| // Compare the content of the strings, not their references | |
| return str1.equals(str2); | |
| } | |
| // Function to print the result | |
| public static void printResult(boolean result) { | |
| if (result) { | |
| System.out.println("str1 == str2"); | |
| } | |
| } | |
| public static void main(String[] args) { | |
| // Example usage of the defined functions | |
| String str1 = new String("Hello"); | |
| String str2 = new String("Hello"); | |
| boolean result = areStringsEqual(str1, str2); | |
| printResult(result); | |
| } | |
| } | |