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
Jimbo99999Asked:
Who is Participating?
 
for_yanCommented:
Certianly, when you have an instance of an object separated by dot from the method
name it means that we want to execute this method on that instance
of the object.

add(Object ) is one of the methods of List interface (implemented by LinkedList class)
which we excute on UserInputList instance of LinkedList
0
 
objectsCommented:
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

0
 
Jimbo99999Author Commented:
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
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
Gurvinder Pal SinghCommented:
Its the array of String object type. Means that each item of that array is of type string
0
 
objectsCommented:
0
 
for_yanCommented:

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

0
 
Jimbo99999Author Commented:
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
0
 
for_yanCommented:
What is it you wnat to explain?
You just add one more lement to the collection
0
 
for_yanCommented:

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
0
 
Jimbo99999Author Commented:
UserInputList.add(x)

Do you say execute .add method on UserInputList ?
0
 
gordon_vt02Commented:
On a side note, you may want to take a look at the Java Coding Conventions Style Guide.  Typically in Java variables and method names start with a lowercase letter using camelCase for subsequent words in the name.

So, in your code, you would use userInputList instead of UserInputList.  It's just a guideline, but it will make your code more readable and understandable to other Java programmers.

http://www.oracle.com/technetwork/java/codeconv-138413.html
0
 
Jimbo99999Author Commented:
Thanks to everyone who replied.  All your contributions help out a lot.

Thanks again,
jimbo99999
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.