Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8878617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:45:18+00:00 2026-06-14T19:45:18+00:00

I cannot understand this error, despite my research throughout this website. At first the

  • 0

I cannot understand this error, despite my research throughout this website. At first the program ran, but it gave me a “y” as a line, and the validator choices were “n”,”n”,”n” all in one. So, I had a look around in my program, found it, solved it. Now I’m faced with this actual and format arguments lists differ in length problem. I’ve tried various things, like changing the variable type, using different variables… so on so forth.

Here’s my code.

 /*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package roshambo;

import java.util.Random;
import java.util.Scanner;

/**
 *
 * @author Owner
 */
public class Roshambo {


    private String name;

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        String choice = "y";
        String player;

        Scanner sc = new Scanner(System.in);
        Random random = new Random();
        char[] ch = new char[]{'r','p','s'};
        int r = random.nextInt(ch.length);
        char raCh = ch[r];

        while (choice.equalsIgnoreCase("y")) {
            System.out.println("Welcome to Roshambo!");
            System.out.println("");

            //System.out.print("Please enter your name here - ");
            //String player = sc.nextLine();

            String player1 = Validator.getRequiredString("Please enter your name here - ",player);

            String roshambo = sc.nextLine();
            String roshambo1 = Validator.getChoiceString1("Please choose Rock, Paper or Scissors. (R/P/S) - ",'r','p','s');


            choice = getChoiceString("Play Again? (y/n): ","y","n");
            System.out.println("");
        }
    }
    public static String getChoiceString(String prompt, String str1, String str2)
    {
        boolean isValid = false;
        Scanner sc = new Scanner(System.in);
        String choice = "";

        while (isValid == false) {
        System.out.print(prompt);
        choice = sc.next();
        if (choice.equalsIgnoreCase(str1) || choice.equalsIgnoreCase(str2)) {
            isValid = true;

        }
        sc.nextLine();

        }
        return choice;
    }
}

What am I doing wrong? I’ll also add in my Validator code, as I think the problems lies between those two.

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package roshambo;

import java.util.Scanner;

/**
 * @author Owner
 */
public class Validator {

    // force the user to enter a string
    public static String getRequiredString(String prompt) {
        Scanner sc = new Scanner(System.in);
        String input = "";
        boolean isValid = false;

        while (isValid == false) {
            System.out.print(prompt);
            input = sc.nextLine();
            if (input.equals("")) {
                System.out.println("Error! This entry is required. Try again.");
            }
            else {
                isValid = true;
            }
        }
        return input;
    }
    // force the user to enter one of three strings
    public static String getChoiceString1(String prompt, String str1, String str2, String str3) {
        String input = "";
        boolean isValid = false;

        while (isValid == false) {
            input = getRequiredString(prompt);
            if (input.equalsIgnoreCase(str1) || input.equalsIgnoreCase(str2) || input.equalsIgnoreCase(str3)) {
                isValid = true;
            }
            else {
                System.out.println("Error! Entry must be '"+ str1 +"', '"+ str2 +"', or '"+ str3 +"'. Try again.");  
            }
        }
        return input;
    }
}

Thanks in advance for the help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T19:45:19+00:00Added an answer on June 14, 2026 at 7:45 pm

    Your getRequiredString method in Validator class is expecting a single String argument, you are passing two arguments, String and a Player(you should however be getting another compiler error, saying cant find player, as you commented it out) in your method call.

    public static String getRequiredString(String prompt) { // is pnly expecting one String argument.
    
        String player1 = Validator.getRequiredString("Please enter your name here - ",player);// passing two arguments
    

    Just pass prompt from your method call and the error would disappear.

     String player1 = Validator.getRequiredString("Please enter your name here - ");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following code when compiled give this error I cannot understand why this is
I cannot understand why the code below is giving me this error in firebug
I can map 1:1 (one-to-one) tables intuitively, like this: But I cannot understand how
I cannot understand why this keeps crashing with a memory error: server = new
I must have a syntax problem, but I cannot understand what this means -
Sorry if this seems silly, I just cannot understand this runtime error I'm getting.
I have the following code which is producing this error. I cannot understand why
I cannot understand this query? select @:vfOutBalance+@:vfHSSubTotal+@3+orpartpayment,@:vfOutBalance+@:vfHSSubTotal from or_equip_upgrd_id what does @3 mean?
I cannot understand why this throws undefined reference to `floor' : double curr_time =
I cannot understand why I am getting deadlock in this simple sample.What is wrong

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.