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 3978360
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:02:17+00:00 2026-05-20T05:02:17+00:00

I have another error, unexpected type required:variable found:value and I can’t figure out why.

  • 0

I have another error, unexpected type required:variable found:value and I can’t figure out why. The code is as follows:

public class ISBNText extends JTextField
{  
    protected static final int ISBN_NUM=10;
    protected static String bookNum;
    protected JTextField  bookText; 
    protected String valid;
    public ISBNText() 
    {
        super(20);
    }   

    public String getISBN()
    {           
        bookNum = getText();
        return bookNum;
    }

    private String validateISBN(String bookNum)throws ISBNException
    {
        boolean check=false;
        bookNum.replaceAll("-","");
        if (bookNum.length()!=ISBN_NUM)
            throw new ISBNException ("ISBN "+ bookNum + " must be 10 characters");
        for (int i=0;i<bookNum.length()-1;i++)
        {
            if (Character.isDigit(bookNum.charAt(i)))
                check=true;
        }  
        if (bookNum.charAt(9)=='X') check=true;
        if (Character.isDigit(bookNum.charAt(9))) check=true;
        if (check=false) throw new ISBNException ("ISBN " + bookNum + " must contain all digits" + 
                "or 'X' in the last position");
        if (checkDigit(bookNum)=false)      //////////COMPILER   ERROR    HERE////////
            throw new ISBNException ("ISBN " + bookNum + " is invalid.\n" + 
                "ISBN " + bookNum + " should be " + validnum);
        if (check=true) return bookNum;
    }                             

    public boolean checkDigit (String bookNum)
    {
        boolean status;
        double total=0.0;
        char[] check   = {0,1,2,3,4,5,6,7,8,9,X};
        int[] checkNums= {0,1,2,3,4,5,6,7,8,9,10};
        for (int i=0;i<bookNum.length;i++)
        {
            check(i)=bookNum[i];
            total+=check[i]*checkNums[i];
        }    
        if ((checkNums[9] % 11)==check[9])
            status = true;
        else 
            status=false;
    }
}

This program is being used to check the validity of an ISBN number entered by a user. I don’t understand why it says it finds value and it expects a variable, as bookNum is a variable. I have no doubt that this is due to my limited knowledge. Hoping you guys can help me out one more time.

  • 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-05-20T05:02:18+00:00Added an answer on May 20, 2026 at 5:02 am

    checkDigit(bookNum)=false should be !checkDigit(bookNum)

    Same thing for if (check=false) which should be if (!check)
    Another with if (check=true)

    Also,

    for (int i=0;i<bookNum.length;i++)
    {
        check(i)=bookNum[i];
        total+=check[i]*checkNums[i];
    }    
    

    Should be :

    for (int i=0;i<bookNum.length();i++)
    {
        (something, but definitely not a function result)=bookNum.charAt(i);
        total+=check[i]*checkNums[i];
    }
    

    Plus,

    char[] check   = {0,1,2,3,4,5,6,7,8,9,X}; // X won't compile
    

    Plus,

    checkDigit has no return.

    Plus,

    validnum is not declared

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have another script that I can't figure out what is wrong with it.
I have code to create another row (div with inputs) on a button click.
I have a value like this: Foo Bar Another Value something else What regex
Put it another way: what code have you written that cannot fail. I'm interested
Hey! I am not trying to push my luck here but I have another
I'm developing a Linux driver loadable module and I have to use another device
I have a situation where another developer is including source files from a project
I have a ListView inside another ListView, and I'd like to hide a table
I have a Java application that launches another java application. The launcher has a
I have an application that writes to another application and needs to provide the

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.