{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

CS1113_Homework 6 # 1

CS1113_Homework 6 # 1 - if(scan.hasNextInt iA =...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 // Matt Hergenrether // Section 10 // CS 1113 // April 10, 2008 // Homework 6 # 1 // exchanges the values of the variables iA and iB import java.util.* // util contains the Scanner class public class Exchange { public static void main(String[] args) { // Declare named constants int iA = 0 int iB = 0 int temp = 0 Scanner scan = new Scanner(System.in)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: if(scan.hasNextInt()) { iA = scan.nextInt() } else { System.out.println("Error") System.exit(0) } if(scan.hasNextInt()) { iB = scan.nextInt() } else { System.out.println("Error") System.exit(0) } // start of process temp = iA iA = iB iB = temp } // End of Main } //End of class...
View Full Document

{[ snackBarMessage ]}