Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Security / November 2003

Tip: Looking for answers? Try searching our database.

Reading from an Array ==Tokenizer

Thread view: 
Andy K - 17 Nov 2003 13:08 GMT
Would you please help ne. I am trying to read from an array but I keep
getting an error (Variable not defined. here is the piece of code please
help.
{StringTokenizer tokens;

tokens = new StringTokenizer(textLiner)
teamName = tokens.nextToken();
points = Integer.parsInt(tokens.nextToken());

premiership t[] = new Premiership[20];
int i;
for (i=0; i<t.length;i++);
 {
   t[i] = new Premiership(teamname,points);
    t[i].teamName = teamName;
    t[i].points = points;
}
David Rabinowitz - 18 Nov 2003 09:10 GMT
Try this:

StringTokenizer tokens;

tokens = new StringTokenizer(textLiner)
String teamName = tokens.nextToken();
<--------------
int points = Integer.parseInt(tokens.nextToken());
<--------------

Premiership t[] = new Premiership[20];
<--------------
int i;
for (i=0; i<t.length;i++);
  {
    t[i] = new Premiership(teamname,points);
     t[i].teamName = teamName;
     t[i].points = points;
}

also, how does it relates to security ?

David

> Would you please help ne. I am trying to read from an array but I keep
> getting an error (Variable not defined. here is the piece of code please
[quoted text clipped - 13 lines]
>      t[i].points = points;
> }
David Postill - 18 Nov 2003 09:28 GMT
| Would you please help ne. I am trying to read from an array but I keep
| getting an error (Variable not defined. here is the piece of code please
[quoted text clipped - 4 lines]
| teamName = tokens.nextToken();
| points = Integer.parsInt(tokens.nextToken());
                  ^^^^^^^

Integer.parseInt()

| premiership t[] = new Premiership[20];
| int i;
[quoted text clipped - 4 lines]
|      t[i].points = points;
| }

i<davidp />

- --
David Postill


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.