Solved

java programming

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java DateChooser? 3 36
why cannot we forward request once the response is committed 2 42
servlet example 11 40
How do I remove an object from a 3 25
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
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.

773 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