Spaces:
Build error
Build error
Download YourJavaProgram.java from tracywong117/Run-Docker-Testing: direct link, hf CLI and curl.
- Browser
- Download file 1.04 kB
-
https://huggingface.co/spaces/tracywong117/Run-Docker-Testing/resolve/main/YourJavaProgram.java
- Command line
-
hf download hf://spaces/tracywong117/Run-Docker-Testing/YourJavaProgram.java
-
curl -L -o YourJavaProgram.java https://huggingface.co/spaces/tracywong117/Run-Docker-Testing/resolve/main/YourJavaProgram.java
1.04 kB
| // YourJavaProgram.java | |
| import java.io.FileWriter; | |
| import java.io.IOException; | |
| public class YourJavaProgram { | |
| public static void main(String[] args) { | |
| // Check if the input argument is provided | |
| if (args.length < 1) { | |
| System.out.println("Please provide an input argument."); | |
| return; | |
| } | |
| // Parse the input argument as an integer | |
| int number; | |
| try { | |
| number = Integer.parseInt(args[0]); | |
| } catch (NumberFormatException e) { | |
| System.out.println("Invalid input argument. Please provide an integer."); | |
| return; | |
| } | |
| // Perform some operation or computation | |
| int result = number * 2; | |
| // Create a file writer for the output file | |
| try (FileWriter writer = new FileWriter("output.txt")) { | |
| // Write the result to the output file | |
| writer.write(String.valueOf(result)); | |
| } catch (IOException e) { | |
| e.printStackTrace(); | |
| } | |
| } | |
| } |