Note that there are some explanatory texts on larger screens.

plurals
  1. POanother homework question error unexpected type required:variable found:value
    primarykey
    data
    text
    <p>I have another error, unexpected type required:variable found:value and I can't figure out why. The code is as follows:</p> <pre><code>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&lt;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&lt;bookNum.length;i++) { check(i)=bookNum[i]; total+=check[i]*checkNums[i]; } if ((checkNums[9] % 11)==check[9]) status = true; else status=false; } } </code></pre> <p>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.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload