代码编译但输出不正确。
import javax.swing.JOptionPane;
public class binaryValidation
{
public static void main( String [] args )
{
String inputUser = "";
boolean binaryWord;
inputUser = JOptionPane.showInputDialog( null,
"Enter a Binary Word" );
for ( int i = inputUser.length( ) - 1; i >= 0; i++ )
{
if ( inputUser.charAt( i ) == 0 || inputUser.charAt( i ) == 1 )
JOptionPane.showInputDialog( null,
"The Binary Word is valid" );
else
JOptionPane.showInputDialog( null,
"The Binary Word is not valid" );
}