Solved

java programming

Posted on 2004-10-03
4
170 Views
Last Modified: 2010-03-31
for(int i = 0; i < fields.length; i++) {
                  try {
                        hasAccess = fields[i].isAccessible();
                        fields[i].setAccessible(true);
                        System.out.println("F[" + i + "] = " + fields[i] + " : " +
                        fields[i].get(data));
                        fields[i].setAccessible(hasAccess);
                  } catch(IllegalAccessException iae) {}
            }

what's the  purpose of  i&lt?
0
Comment
Question by:sraveend
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 19

Assisted Solution

by:ramazanyich
ramazanyich earned 50 total points
ID: 12213935
It should be replaced by < sign:
 for(int i = 0; i < fields.length; i++) {
0
 
LVL 2

Assisted Solution

by:Breadstick
Breadstick earned 100 total points
ID: 12214114
If you replaced > with &lt; because you thought html would be rendered in your post, it was unnecissary.  I'm not sure if that was your question though.

If this was your question:
"What is the  purpose of  i<fields.length in this block of code?"
Then your answer is, i<fields.length is the condition that must be met before the loop will finish iterating.

A for loop consists of three parts, the initialization, the condition, and the statement.
for ( init   ;   condition   ;   statement )

The initialization sets an initial state for a variable.  The condition is the condition that the variable must be in before the loop will finish.  And the statement is what to do in order to change the variable in your condition.  For example,
for ( i=0; i<5; i++)
The first part "let there be a variable called i, and have it initially set to zero".  The second part says: "keep iterating through the loop while i<5 is true", and the third part says: "after each iteration through the loop body, increment i".

Sorry if that was confusing, I hope that helped.
0
 
LVL 37

Accepted Solution

by:
zzynx earned 100 total points
ID: 12214998
"&lt;" is just HTML code for the character "<"  (lt stands for "less than")
"&gt;" is the HTML code for the character ">" (gt stands for "greater than")

I guess you get this by copying/pasting the code from the source code of an HTML page.
So, that should be:

          for (int i = 0; i < fields.length; i++) {
0
 
LVL 37

Expert Comment

by:zzynx
ID: 12216226
Thanks for accepting
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

635 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