Solved

java programming

Posted on 2004-10-03
4
157 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
  • 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

758 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

21 Experts available now in Live!

Get 1:1 Help Now