Solved

java programming

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
My project did see openJDK that I installed. What could be the problem 7 123
topping2 challenge 13 83
table example 4 23
servlet filter example 37 43
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…
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.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

920 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

17 Experts available now in Live!

Get 1:1 Help Now