// CS 1621 Fall 2005 // Improved reliability by avoiding the operator confusion error // of C++. In Java, if assignment is mistaken for comparison, a // compilation error will occur, since the expression result must // be boolean. import java.io.*; public class assign { public static void main(String [] args) throws IOException { BufferedReader BR = new BufferedReader( new InputStreamReader(System.in)); int num; System.out.println("Please enter a one or a two:"); num = Integer.parseInt(BR.readLine()); if (num = 1) // will give a compilation error System.out.println("You entered one"); else System.out.println("You entered two"); } }