Final answer:
To assign the decimal equivalent of a binary string to an integer variable in Java, use the Integer.parseInt method with the binary string and the radix 2 as arguments.
Step-by-step explanation:
The Java statement to assign the decimal equivalent of a binary string to an int variable num involves using the Integer.parseInt method. For example:num = Integer.parseInt(binaryString, 2);This statement uses parseInt from the Integer class and converts a binary number (in string format) to its decimal equivalent. The first argument 'binaryString' should be your binary number as a string, and the second argument '2' indicates that the binary numeral system is being used (base 2).
The code to complete the Java statement that assigns the decimal equivalent of a given binary string to the int variable num is:num = Integer.parseInt(binaryString, 2);This statement makes use of the parseInt method from the Integer class in Java. The parseInt method takes two parameters: the binaryString to convert to an int value, and the base (in this case, 2 for binary). It returns the decimal equivalent of the binary string.