ex6NeedObjects

ex6NeedObjects - System.out.print(Please enter student...

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

View Full Document Right Arrow Icon
/* UnwieldyClass * * This class demonstrates how classes can make code better organized. */ import java.util.Scanner; public class UnwieldyClass { public static void main(String args[]) { String studentName1, studentName2, studentName3; int studentPermNo1, studentPermNo2, studentPermNo3; String studentAddr1, studentAddr2, studentAddr3; String studentPhone1, studentPhone2, studentPhone3; // notice that we can declare and initialize on the same line! Scanner readInfo = new Scanner( System.in ); // now get the info System.out.print(â±Please enter student name:â±); studentName1 = readInfo.nextLine(); System.out.print(â±Enter permanent numberâ±); studentPermNo1 = readInfo.nextInt(); readInfo.nextLine(); System.out.print(â±Enter addressâ±); studentAddr1 = readInfo.nextLine(); System.out.print(â±Enter phone numberâ±); studentPhone1 = readInfo.nextLine();
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: System.out.print(Please enter student name:); studentName2 = readInfo.nextLine(); System.out.print(Enter permanent number); studentPermNo2 = readInfo.nextInt(); readInfo.nextLine(); System.out.print(Enter address); studentAddr2 = readInfo.nextLine(); System.out.print(Enter phone number); studentPhone2 = readInfo.nextLine(); System.out.print(Please enter student name:); studentName3 = readInfo.nextLine(); System.out.print(Enter permanent number); studentPermNo3 = readInfo.nextInt(); readInfo.nextLine(); System.out.print(Enter address); studentAddr3 = readInfo.nextLine(); System.out.print(Enter phone number); studentPhone3 = readInfo.nextLine(); . and then the rest of our program here . . }...
View Full Document

Ask a homework question - tutors are online