{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

{[ snackBarMessage ]}