Wednesday, October 7, 2009

[Java] Help with Java

 

Hey all...

I'm writing my Final IT p1 Exam this friday (9/10)...

what is the best way to study the coding?
the paper is sub-divided into
1) Database programming
2) Array of objects
3) Two Dimensional Arrays

the SQL's i'm fine with.
its part 2 and 3 thats not great.

an example :

Pilots[] pi = new Pilots[15];
int numEmp = 0;

try {
Scanner inputStream = new Scanner(new FileInputStream("Pilots.txt"));

while (inputStream.hasNextLine()) {
String line = inputStream.nextLine();
Scanner lineReader = new Scanner(line).useDelimiter("#");

int e = lineReader.nextInt();
String f = lineReader.next();
String s = lineReader.next();
double hr = lineReader.nextDouble();
double h = lineReader.nextDouble();
lineReader.close();

pi[numEmp] = new Pilots(e, f, s, hr, h);

numEmp++;
}

inputStream.close();

} catch (FileNotFoundException e) {
System.out.println("Pilots.txt could NOT be opened");
System.exit(0);
}

__._,_.___
Visit http://aiaiai.com or http://jgame.org for more groups to join.
Java Official Group is created for the following topics: Java 2 Enterprise Edition - J2EE, Java 2 Standard Edition - J2SE, Java 2 Micro Edition - J2ME, XML, XSL, XSD, XPATH, Web Services, Jini, JXTA for all type of Java Geeks.
Whoever posts spam / ads / job related message will be BANNED IMMEDIATELY
Recent Activity
Visit Your Group
Give Back

Yahoo! for Good

Get inspired

by a good cause.

Y! Toolbar

Get it Free!

easy 1-click access

to your groups.

Yahoo! Groups

Start a group

in 3 easy steps.

Connect with others.

.

__,_._,___

No comments:

Post a Comment