Skip to Main Content

General Development Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

wearied problem with program arguments input.

Hi everyone.

I have a problem with program arguments input the if statement does not execute if the args less than 4, I don't know why I have many times and there is no benefit.

Example of my program:

if (args[0] == "-t" || args[0] == "--texts"){
if(args.length<=2){
System.err.println("ERROR:You did not been passed enough arguments, you have to pass two arguments or three if you want to save the combination result at a file or the result will be printed");
System.exit(1);
}else if (args.length>4){
System.err.println("ERROR:You have passed too arguments, you have passed this number of arguments "+args.length+", you have to pass two arguments or three if you want to save the combination result at a file or the result will be printed");
System.exit(1);
}

}

Comments
Post Details
Added on May 27 2025
0 comments
30 views