Link to home
Start Free TrialLog in
Avatar of Jimbo99999
Jimbo99999Flag for United States of America

asked on

Java Code Translation

Good Day Experts

I am relatively new to Java...the programming is getting better.  However, I am still thin on the terminology to explain the code.  Here are some lines of code that I am using but am curious how they "translate".  UserInput is my LinkedList.  Can someone reply with the proper way to say what each of these lines of code are?

import java.util.LinkedList;  
String[] UserInputTokens = UserInput.split(delims);
for (String t : UserInputTokens ){
       //process
}

Thanks,
jimbo99999
Avatar of Mick Barry
Mick Barry
Flag of Australia image

import java.util.LinkedList;  

tell the compiler what class you will be using

String[] UserInputTokens = UserInput.split(delims);

split the UserInput string on the delim delimiter

for (String t : UserInputTokens ){
       //process
}

Loop processing each of the tokens returned from splitting the UserInput string

Avatar of Jimbo99999

ASKER

Thanks sounds good...

One last inquiry about the line --> String[] UserInputTokens = UserInput.split(delims);

How do you say what the [] are after String?

Thanks,
jimbo99999
SOLUTION
Avatar of Gurvinder Pal Singh
Gurvinder Pal Singh
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

In Java, I guess as opposed to C and some other languages, you can
declare arrays with the array specification after the variable, as well as
before the variable - between the variable and the type.

You can either declare:

String myStrings[];

or you can say

String [] myStrings;

At first this latter method looks odd when you come from other
languages, but it is probably even more popular in Java programs
 than the former way

Thanks...I forgot one.  Promise the last one.

When I add the token to my LinkedList i do --> UserInputList.add(x)

How do I explain that in English?  I know this is bad that I use it and cannot describe but I am learning.

Thanks,
jimbo99999
What is it you wnat to explain?
You just add one more lement to the collection

What is it you want to explain?
You just add one more element to the collection, as your linked list is one of the variants of a collection
UserInputList.add(x)

Do you say execute .add method on UserInputList ?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks to everyone who replied.  All your contributions help out a lot.

Thanks again,
jimbo99999