Solved

Please help me to read a strings from an external file, parse some strings and then write those string back to an external file

Posted on 2004-08-04
41
292 Views
Last Modified: 2010-03-31
Hi I'm new to Java Programming. I am reading few lines from an external file. The content of the file is

nn: fn=ltaster1, ut=myusers, nt=my-domain,cc=comcast
myobjectClass: BusinessUnitPerson
fn: ltaster1
ln: ltaster1


Therefore the input file has the above 4 lines. Once I read the first line I need to test the value of fn, to be more precisely the value of the digit at the end of this string. Since the value of fn is "ltaster1" so need to see what is the end digit in the above case its 1.

Once I find the this last digit which always going to be numeric, increment it to 1, and then write to an output file.  Once it done in the output file the string should look like
nn: fn=ltaster2, ut=myusers, nt=my-domain,cc=comcast.

Then I read the second line from the input file and simply write it back to the output file.

Once I read the third and fourth line I repeat the same things like the first line. So final output into the external file would look like

nn: fn=ltaster2, ut=myusers, nt=my-domain,cc=comcast
myobjectClass: BusinessUnitPerson
fn: ltaster2
ln: ltaster2

I wrote a program that is reading the entire file and writing back to an output file. I am not at all sure how to perform the above steps those I mentioned.

Moreover I need to perform this operation at least 11000 times.

So the final output file would look like

nn: fn=ltaster2, ut=myusers, nt=my-domain,cc=comcast
myobjectClass: BusinessUnitPerson
fn: ltaster2
ln: ltaster2
.
.
.
nn: fn=ltaster400, ut=myusers, nt=my-domain,cc=comcast
myobjectClass: BusinessUnitPerson
fn: ltaster400
ln: ltaster400
.
.
.
nn: fn=ltaster4500, ut=myusers, nt=my-domain,cc=comcast
myobjectClass: BusinessUnitPerson
fn: ltaster4500
ln: ltaster4500
.
.
.
nn: fn=ltaster9890, ut=myusers, nt=my-domain,cc=comcast
myobjectClass: BusinessUnitPerson
fn: ltaster9890
ln: ltaster9890
.
.
.
nn: fn=ltaster11000, ut=myusers, nt=my-domain,cc=comcast
myobjectClass: BusinessUnitPerson
fn: ltaster11000
ln: ltaster11000

Here is my program
----------------------------------------------------------------------------------------
import java.io.*;

class FileTest {
    public static void main(String[] args) {
        try {
            File inputFile = new File("inFile.txt");
            File outputFile = new File("outFile.txt");

            FileInputStream fis = new FileInputStream(inputFile);
            FileOutputStream fos = new FileOutputStream(outputFile);
            int c;

            while ((c = fis.read()) != -1) {
                     fos.write(c);
            }

            fis.close();
            fos.close();
        } catch (FileNotFoundException e) {
            System.err.println("FileTest: " + e);
        } catch (IOException e) {
            System.err.println("FileTest: " + e);
        }
    }
}
---------------------------------------------------------------------------------------------
Please help me to modify this program so it does the things I mentioned above.

Yours help is greatly appreciated.


0
Comment
Question by:nickmcdonald
  • 14
  • 10
  • 9
  • +2
41 Comments
 
LVL 92

Accepted Solution

by:
objects earned 143 total points
ID: 11723306
first change would be to use a BufferedReader to read the file line by line using the readLine() method.

BufferedReader in = new BufferedReader(new FileReader(inputFile));
String line = null;
while (null!=(line=in.readLine()))
{
   System.out.println(line);
   // process line
}
in.close();
0
 

Author Comment

by:nickmcdonald
ID: 11723358
Thanks ...but I do the rest of the things I mentioned. In other words how I process those lines.

Please enlighten me.

Thanks !!!
0
 
LVL 92

Expert Comment

by:objects
ID: 11723380
The String split() method seems the simplest to achieve your goal.
eg. for the 1st line

String[] values = line.substring(3).split(",");
for (int i=0; i<values.length; i++)
{
   String[] keyvalue = values[i].split("=");
   if (keyvalue[0].equals("fn"))
   {
      int n = keyvalue[1].length();
      int lastdigit = (int)(keyvalue.charAt(n-1) - '0');
   }
}
0
 
LVL 16

Assisted Solution

by:krakatoa
krakatoa earned 141 total points
ID: 11724209
Are the values of ltaster in lines 1, 3 and 4 always the same for each record - meaning if it's "ltaster229" in line 1, is it the same in lines 3 and 4?
0
 
LVL 16

Expert Comment

by:krakatoa
ID: 11724377
... because if it is, then you can quite simply do this (the System.out.printlns are just for illustration obviously):



//incoming strings (from your file)

String line_1 ="nn: fn=ltaster11900, ut=myusers, nt=my-domain,cc=comcast";
String line_2 ="myobjectClass: BusinessUnitPerson";
String line_3 ="fn: ltaster11900";
String line_4 ="ln: ltaster11900";


System.out.println(line_1);
System.out.println(line_2);
System.out.println(line_3);
System.out.println(line_4);


int ltaster_updated_int;
String ltaster_updated = "";

ltaster_updated_int = Integer.parseInt(line_1.substring(line_1.indexOf("ltaster")+7,line_1.indexOf(",")))+1;

ltaster_updated = Integer.toString(ltaster_updated_int);



//outgoing strings (to new file, or wherever)

String out_line_1 ="nn: fn=ltaster"+ltaster_updated+", ut=myusers, nt=my-domain,cc=comcast";
String out_line_2 =line_2;
String out_line_3 ="fn: "+ltaster_updated;
String out_line_4 ="ln: "+ltaster_updated;

System.out.println();System.out.println();

System.out.println(out_line_1);
System.out.println(out_line_2);
System.out.println(out_line_3);
System.out.println(out_line_4);
0
 

Author Comment

by:nickmcdonald
ID: 11727582
Thanks to you all.

However I think I did not clearly explain about my porbloem.
The input file has only four lines such as

nn: fn=ltaster1, ut=myusers, nt=my-domain,cc=comcast
myobjectClass: BusinessUnitPerson
fn: ltaster1
ln: ltaster1

and that’s it.

What I need to do is read these four lines and change the value of ltaster1 to ltaster2 and continue this operation for 11000 times. As you can see “ltaster1” appears in the first, third and fourth line. As program increment the values of this “ltaster1” from each line write this line into an output file.

Then read the next line since this donot have ltaster1 just write the whole line into the output file.

Then read the third and fourth line and change the value of “ltaster1” and write those lines into output file.

Now in the output file the values would  be

nn: fn=ltaster2, ut=myusers, nt=my-domain,cc=comcast
myobjectClass: BusinessUnitPerson
fn: ltaster2
ln: ltaster2

However not to forget that I need to save these above lines values somewhere because the program read the input file just once.  What I need to do is update in the following lines “ltaster2” values to “ltaster3” and then write these lines back to output file again.  

Therefore once the program run through second time then my output file would look like


nn: fn=ltaster2, ut=myusers, nt=my-domain,cc=comcast
myobjectClass: BusinessUnitPerson
fn: ltaster2
ln: ltaster2


nn: fn=ltaster3, ut=myusers, nt=my-domain,cc=comcast
myobjectClass: BusinessUnitPerson
fn: ltaster3
ln: ltaster3


I guess all I am trying to say I read from the input file only once those 4 lines.

Then the program increment the value of ltaster1 to ltaster2

Program writes the incremented values along with the other lines into the output file.

Somewhere I need to save these new updated 4 lines because program needs to read these new-updated lines and change the values of “ltaster”, again.


Then read these following saved lines


nn: fn=ltaster2, ut=myusers, nt=my-domain,cc=comcast
myobjectClass: BusinessUnitPerson
fn: ltaster2
ln: ltaster2


And change ltaster2 to ltaster3 and write the following lines back to output files

nn: fn=ltaster3, ut=myusers, nt=my-domain,cc=comcast
myobjectClass: BusinessUnitPerson
fn: ltaster3
ln: ltaster3

Not to forget the above lines need to be saved again somewhere in the memory. Because we need to read these above lines and repeat the processing I explain above.

I guess I need some kind of loop because this process needs to continue for 11,000 times.

When program finished running the final output file looks like the following:


nn: fn=ltaster2, ut=myusers, nt=my-domain,cc=comcast
myobjectClass: BusinessUnitPerson
fn: ltaster2
ln: ltaster2


nn: fn=ltaster3, ut=myusers, nt=my-domain,cc=comcast
myobjectClass: BusinessUnitPerson
fn: ltaster3
ln: ltaster3


nn: fn=ltaster4, ut=myusers, nt=my-domain,cc=comcast
myobjectClass: BusinessUnitPerson
fn: ltaster4
ln: ltaster4


nn: fn=ltaster5, ut=myusers, nt=my-domain,cc=comcast
myobjectClass: BusinessUnitPerson
fn: ltaster5
ln: ltaster5

……
……
……
……

nn: fn=ltaster11000, ut=myusers, nt=my-domain,cc=comcast
myobjectClass: BusinessUnitPerson
fn: ltaster11000
ln: ltaster11000


Please hlep me I am not sure how to do this... please need a step by step help
0
 

Assisted Solution

by:krispin
krispin earned 141 total points
ID: 11727948
Here's a prossible solution. I assumed the word preceeding the number in question is always going to by ltaster:
------------------------------------------------------------------

import java.io.*;

class FileTest {
    public static void main(String[] args) {
        try {
            BufferedReader fileReader = new BufferedReader(new FileReader("inFile.txt"));

          //Array for the 4 lines from the input file
            String lines[] = new String[4];
           
          String line = "";
            int i = 0;

          //Loop reads in the 4 lines into the array
            while((line=fileReader.readLine()) != null)
            {
                lines[i] = line;
                System.out.println(lines[i]);
                i++;                
            }
            //close the BufferedReader (not needed anymore)
            fileReader.close();
          
            /*This gets the starting position in the line of the number in question and stores it in "index"*/
            int index = lines[0].indexOf("ltaster") + 7;

            //This for loop does everything else you need
            for(int x = 0; x < 11000; x++)
            {
                //index2 will store the end position of the number in question
                int index2 = index+1;

                try {
                    /*This loop is used to determine the end position of the number in question*/
                    while(true) {
                        Integer.parseInt(Character.toString(lines[0].charAt(index2)));
                        index2++;
                    }
                }
                /*Don't bother handling the exception here, it WILL occur and is supposed to*/
                catch(NumberFormatException e){}

                /*Once the start and end positions on the number have been determined,
                 this next line extracts the number and converts from String to int*/
                int number = Integer.parseInt(lines[0].substring(index, index2));

                String old = "ltaster" + Integer.toString(number);
                number++;
                //update will be the "ltaster" and the new number
                String update = "ltaster" + Integer.toString(number);

                /*Next, we split the first line into two, the split
                 takes place at "ltaster" (this removes the "ltaster" part from the line*/
                String subStrings[] = lines[0].split(old);
     
                /*Next, we change the lines in the array, substituting the new ltaster number for the old*/
                lines[0] = subStrings[0] + update + subStrings[1];
                lines[2] = "fn: " +update;
                lines[3] = "ln: " +update;

            }
        }
        catch(Exception e) {
            System.out.println(e);
        }
    }
}

------------------------------------------------------------------

The only thing you need to do is write the code to output the contents of the lines array to the file.
0
 
LVL 16

Expert Comment

by:krakatoa
ID: 11728005
nickmacdonald:

You are losing yourself in repetitions of what is a simple problem, and as far as I can see, you have only reiterated the exact same scenario that you did in your original question. When you say this :

 >>Then the program increment the value of ltaster1 to ltaster2 << ...

well that is exactly what the code I supplied does. For a start I dont see any "ltaster2" in your example, as you say there is, but even if there were, and even if the new data is coming from a file, or coming again from what you have just written (if you use my code), it doesnt matter, because all you have to arrange is for the output to go where you want it to, instead of to System.out as in my example. ;)
0
 
LVL 16

Expert Comment

by:krakatoa
ID: 11728044
Have you in fact tried to run the code I supplied ?? It can be compiled and run as it is.
0
 

Author Comment

by:nickmcdonald
ID: 11728616
Thanks to you all.

Heres the program

_______________________________________________________________

import java.io.*;
import java.util.*;

class FileReadWrite {
    public static void main(String[] args) {

             //File outputFile = new File("inFile.txt");
             //FileOutputStream fos = new FileOutputStream(outputFile);
        try {
             BufferedReader fileReader = new BufferedReader(new FileReader("user2.ldif"));

             //Array for the 4 lines from the input file
             String lines[] = new String[4];
           
             String line = "";
             int i = 0;

             //Loop reads in the 4 lines into the array
             while((line=fileReader.readLine()) != null)
             {
                 lines[i] = line;
                 System.out.println(lines[i]);
                 i++;                
             }
             //close the BufferedReader (not needed anymore)
             fileReader.close();
         
             /*This gets the starting position in the line of the number in question and stores it in "index"*/
             int index = lines[0].indexOf("ltaster") + 7;

            //This for loop does everything else you need
            for(int x = 0; x < 11000; x++)
            {
                //index2 will store the end position of the number in question
                int index2 = index+1;

                try {
                    /*This loop is used to determine the end position of the number in question*/
                    while(true) {
                        Integer.parseInt(Character.toString(lines[0].charAt(index2)));
                        index2++;
                    }
                }
                /*Don't bother handling the exception here, it WILL occur and is supposed to*/
                catch(NumberFormatException e){}

                /*Once the start and end positions on the number have been determined,
                 this next line extracts the number and converts from String to int*/
                int number = Integer.parseInt(lines[0].substring(index, index2));

                String old = "ltaster" + Integer.toString(number);
                number++;
                //update will be the "ltaster" and the new number
                String update = "ltaster" + Integer.toString(number);

                /*Next, we split the first line into two, the split
                 takes place at "ltaster" (this removes the "ltaster" part from the line*/
                String subStrings[] = lines[0].split(old);
     
                /*Next, we change the lines in the array, substituting the new ltaster number for the old*/
                lines[0] = subStrings[0] + update + subStrings[1];
                lines[2] = "fn: " +update;
                lines[3] = "ln: " +update;

             // ***** I added this loop to test the lines array
               for (int j=0; j< lines.length; j++) {
                   System.out.println("The value of the line arry is" + lines[j]);
      }

            }
        }
        catch(Exception e) {
            System.out.println(e);
        }
    }
}

_________________________________________________________

All I did added a for loop to print the con tents lines array. When I compile this program I get the following errors

C:\java>javac FileReadWrite.java
FileReadWrite.java:40: cannot resolve symbol
symbol  : method toString  (char)
location: class java.lang.Character
               Integer.parseInt(Character.toString(lines[0].charAt(index2)));
                                                  ^
FileReadWrite.java:58: cannot resolve symbol
symbol  : method split  (java.lang.String)
location: class java.lang.String
                String subStrings[] = lines[0].split(old);
                                           ^

2 errors

Any idea please
0
 
LVL 16

Expert Comment

by:krakatoa
ID: 11728781
>> Integer.parseInt(Character.toString(lines[0].charAt(index2)));

You haven't assigned the return value to anything.

>> String subStrings[] = lines[0].split(old);


This shoud be String[] =
0
 
LVL 16

Expert Comment

by:krakatoa
ID: 11728804
ie. String[] subStrings = lines[0].split(old);
0
 

Author Comment

by:nickmcdonald
ID: 11728974
Hello I ma not sure what you're saying here could you please explain again

I am very sorry I need to complete this, THANKS A LOT
0
 
LVL 16

Expert Comment

by:krakatoa
ID: 11729087
>> lines[0].split(old);

"old" has to be a regular expression - regex. Is it one?
0
 
LVL 16

Expert Comment

by:krakatoa
ID: 11729099
And if you are introducing subString variable for the first time at line 58, then it should be declared as String[] subStrings = ......... .
0
 

Expert Comment

by:krispin
ID: 11729162
You can do that if you want but there's no need for it.
That lines;
Integer.parseInt(Character.toString(lines[0].charAt(index2)));
index2++;

are looped around until a NumberFormatException occurs, at which point index2 will hold the value for the end position of the number you are trying to deal with. You don't need to assign the return value to anything here.

>>String subStrings[] = lines[0].split(old);

This is the same as String[] subStrings = lines[0].split(old);
Java allows you to place the square brackets after the datatype or the variable name
0
 

Expert Comment

by:krispin
ID: 11729215
For example, you main function can be:

public static void main(String[] args)
OR
public staic void main(String args[])
0
 

Expert Comment

by:krispin
ID: 11729308
HI nickmcdonald,
Im not sure what the problem is because I wrote that code and tested it, then copied straight out of my source file onto the page.

Your error at
>>Integer.parseInt(Character.toString(lines[0].charAt(index2)));
 suggests that the compiler can't find the method toString method.

I copied and pasted you program and it compiled fine on my computer. Which version of the Virtual Machine are you using? It shouldn't really matter but are you using Sun Microsystems, or are you using J++ or J#

0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:nickmcdonald
ID: 11729450
Thanks.

 I am using windows XP and sun jdk.


Here is my class path.

C:\jdk1.3.1_04\lib\tools.jar



Still having the same problem

FileReadWrite.java:37: cannot resolve symbol
symbol  : method toString  (char)
location: class java.lang.Character
                        Integer.parseInt(Character.toString(lines[0].charAt(index2)));
                                                  ^
FileReadWrite.java:55: cannot resolve symbol
symbol  : method split  (java.lang.String)
location: class java.lang.String
                String[] subStrings = lines[0].split(old);
                                           ^
0
 

Author Comment

by:nickmcdonald
ID: 11729466
Do I need to import anything else other than

import java.io.*;
0
 

Author Comment

by:nickmcdonald
ID: 11729727
Please help me to compile and solve this problem.

Thanks!!
0
 
LVL 16

Expert Comment

by:krakatoa
ID: 11730008
>> public static void main(String[] args)
OR
public staic void main(String args[]) <<

Yeah, my oversight.

I'd still like to ask nickmcdonald if you've used my code yet, or why it cant do the job?
0
 

Expert Comment

by:krispin
ID: 11730033
Ok, im using 1.4 so that's why certain code will work on mine and not on yours.
Try the following:
Change the line
Integer.parseInt(Character.toString(lines[0].charAt(index2)));
to
Integer.parseInt(new Character(lines[0].charAt(index2)).toString());

Im not sure if that will fix your first error.
0
 
LVL 16

Expert Comment

by:krakatoa
ID: 11730036
Try this perhaps for line 40:

Integer.parseInt(Character.toString((lines[0].charAt(index2))));
0
 
LVL 16

Expert Comment

by:krakatoa
ID: 11730075
And try adding trim() to the end of the number-to-string conversion before you concat it to ltaster.
0
 

Expert Comment

by:krispin
ID: 11730140
As for the second error, do the following:

at the beginning import java.util.*;
and replace the following code:

>>String subStrings[] = lines[0].split(old);
     
>>/*Next, we change the lines in the array, substituting the new >>ltaster number for the old*/
>>lines[0] = subStrings[0] + update + subStrings[1];

With these lines:

StringTokenizer strTok = new StringTokenizer(lines[0], old, false);
lines[0] = strTok.nextToken() + update + strTok.nextToken();


That should have fixed the second error



0
 
LVL 16

Expert Comment

by:krakatoa
ID: 11730152
>> are looped around until a NumberFormatException occurs, at which ...

this I missed or didnt read because it is a failrly clumsy way of evaluating, especially when you have more powerful and intuitive tools available.
0
 

Expert Comment

by:krispin
ID: 11730180
It certainly is clumsy, but I haven't used java in a while so unfortunately its the only way I could remember off the top of my head
:o)
0
 
LVL 16

Expert Comment

by:krakatoa
ID: 11730853
:
)

0
 

Author Comment

by:nickmcdonald
ID: 11731283
Thanks a bunch to all of you.

Here is the final version of the program.

import java.io.*;
import java.util.*;

class FileReadWrite {
    public static void main(String[] args) {

        try {
             BufferedReader fileReader = new BufferedReader(new FileReader("inFile.txt"));

             //Array for the 4 lines from the input file
             String lines[] = new String[4];
           
             String line = "";
             int i = 0;

             //Loop reads in the 4 lines into the array
             while((line=fileReader.readLine()) != null)
             {
                 lines[i] = line;
                 System.out.println(lines[i]);
                 i++;                
             }
             //close the BufferedReader (not needed anymore)
             fileReader.close();
         
             /*This gets the starting position in the line of the number in question and stores it in "index"*/
             int index = lines[0].indexOf("ltaster") + 7;

            //This for loop does everything else you need
            for(int x = 0; x < 11000; x++)
            {
                //index2 will store the end position of the number in question
                int index2 = index+1;

                try {
                      /*This loop is used to determine the end position of the number in question*/
                      while(true) {
               Integer.parseInt(new Character(lines[0].charAt(index2)).toString());
                         index2++;
                      }
                }
                /*Don't bother handling the exception here, it WILL occur and is supposed to*/
                catch(NumberFormatException e){}

                /*Once the start and end positions on the number have been determined,
                 this next line extracts the number and converts from String to int*/
                int number = Integer.parseInt(lines[0].substring(index, index2));

                String old = "ltaster" + Integer.toString(number);
                number++;
                //update will be the "ltaster" and the new number
                String update = "ltaster" + Integer.toString(number);

                /*Next, we split the first line into two, the split
                 takes place at "ltaster" (this removes the "ltaster" part from the line*/
                //String subStrings[] = lines[0].split(old);

      StringTokenizer strTok = new StringTokenizer(lines[0], old, false);

     
                /*Next, we change the lines in the array, substituting the new ltaster number for the old*/
                //lines[0] = subStrings[0] + update + subStrings[1];
      lines[0] = strTok.nextToken() + update + strTok.nextToken();

                lines[2] = "fn: " +update;
                lines[3] = "ln: " +update;

               //***** Print the lines array each time the for Loop execute ******
                System.out.println("The value of the line arry is" + lines[0]);
      System.out.println("The value of the line arry is" + lines[1]);
      System.out.println("The value of the line arry is" + lines[2]);
      System.out.println("The value of the line arry is" + lines[3]);
                        
            }

        }
        catch(Exception e) {
            System.out.println(e);
        }
    }
}

Well program compile and run however it prints on the console like this

C:\java>java FileReadWrite
nn: fn=ltaster1, ut=myusers, nt=my-domain,cc=comcast
myobjectClass: BusinessUnitPerson
fn: ltaster1
ln: ltaster1
nn: fn=ltaster2, u
myobjectClass: BusinessUnitPerson
fn: ltaster2
ln: ltaster2
nn: fn=ltaster3, u
myobjectClass: BusinessUnitPerson
fn: ltaster3
ln: ltaster3
nn: fn=ltaster4, u
myobjectClass: BusinessUnitPerson
fn: ltaster4
ln: ltaster4
nn: fn=ltaster5, u
myobjectClass: BusinessUnitPerson
fn: ltaster5
ln: ltaster5
and so on.

So the question is why after the first time rest of the time "nn: fn=ltaster2, u" this string is geeting truncated?

How do I point lines array to an output file stream? I know I can do on the top of the program the following lines

File outputFile = new File("outFile.txt");
FileOutputStream fos = new FileOutputStream(outputFile);

Now at the end of the for loop I did code like these and I get bunch of comiler errors

fos.write(line[0]);
fos.write(line[1]);
fos.write(line[2]);
fos.write(line[3]);


THANKS SO MUCH
           
0
 
LVL 92

Expert Comment

by:objects
ID: 11731375
> How do I point lines array to an output file stream?

Use a PrintWriter

PrintWriter out = new PrintWriter(new FileWriter(outFile));

out.println(line[0]);
out.println(line[1]);
out.println(line[2]);
out.println(line[3]);
0
 
LVL 16

Expert Comment

by:krakatoa
ID: 11731465
You must be running a different version of your programme, because

>> System.out.println("The value of the line arry is" + lines[0]);

never appears in your console output AFAICS.
0
 

Expert Comment

by:krispin
ID: 11734826
>>So the question is why after the first time rest of the time "nn: fn=ltaster2, u" this string is geeting truncated?

After the line
StringTokenizer strTok = new StringTokenizer(lines[0], old, false);

stick in:
System.out.println("Count: " +strTok.countTokens());
This should always equal 2. If it does not, thats where the problem is.
0
 

Expert Comment

by:krispin
ID: 11735025
Ok, to fix your last problem of truncation do the following:

On line 49:
>>String old = "ltaster" + Integer.toString(number);
Change to:
String old =  + Integer.toString(number);

On line 52:
>> String update = "ltaster" + Integer.toString(number);
Change to:
String update = Integer.toString(number);

and then lines 65 & 66:
>>lines[2] = "fn: " +update;
>>lines[3] = "ln: " +update;
Change to:
lines[2] = "fn: ltaster" +update;
lines[3] = "ln: ltaster" +update;

And that should fix that problem.
0
 

Expert Comment

by:krispin
ID: 11735051
Sorry, the change for line 49 should be:
String old = Integer.toString(number);
NOT
String old = + Integer.toString(number);
0
 

Author Comment

by:nickmcdonald
ID: 11739158
Hello,
   My greetings to all of you.

I finally got it.

THANKS A LOT!!!

Nick
0
 
LVL 3

Expert Comment

by:JohnnyAffa
ID: 11741760
glad i could help 8-)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
The viewer will learn how to implement Singleton Design Pattern in Java.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now