what is happening in this code?

Hi, I am new to java

What is happening in this snippet of code?

public name()//Constructor

{

chars=0;

caps=0;

lowercase=0;

gaps=0;

feqnum=newint [5];//is this some sort of an array?

feqnum[0]=0;

feqnum[1]=0;

feqnum[2]=0;

feqnum[3]=0;

feqnum[4]=0;

}

[557 byte] By [andy2672a] at [2007-11-27 2:27:44]
# 1
yes, it's some sort of array. an array of ints, no less. the following statements are superfluous, though. it's already initialized to be full of zeros. and it would be easier to do it in a loop anyway
georgemca at 2007-7-12 2:38:49 > top of Java-index,Java Essentials,New To Java...
# 2
what you need from this code ?whats ur problem?
deepak_cuceka at 2007-7-12 2:38:49 > top of Java-index,Java Essentials,New To Java...
# 3

It is from a program I am trying to understand

public class name{

//Data Members

private int chars;

private int caps;

private int lowercase;

private int gaps;

private long totcha;

private int []freqnum;

public name()//Constructor

{

chars=0;

caps=0;

lowercase=0;

gaps=0;

feqnum=new int [5]; //is this some sort of an array?

feqnum[0]=0;

feqnum[1]=0;

feqnum[2]=0;

feqnum[3]=0;

feqnum[4]=0;

}

Message was edited by:

andy2672

andy2672a at 2007-7-12 2:38:49 > top of Java-index,Java Essentials,New To Java...
# 4
don't mind me. I'm invisible today
georgemca at 2007-7-12 2:38:50 > top of Java-index,Java Essentials,New To Java...
# 5
what
deepak_cuceka at 2007-7-12 2:38:50 > top of Java-index,Java Essentials,New To Java...
# 6
I'm seeing a fault in de codeprivate int []freqnum;must be:private int []feqnum; Satanduvel
Satanduvela at 2007-7-12 2:38:50 > top of Java-index,Java Essentials,New To Java...
# 7
> I'm seeing a fault in de code> > private int []freqnum;> > must be:> > private int []feqnum; > > Satanduvelno it mustn't
georgemca at 2007-7-12 2:38:50 > top of Java-index,Java Essentials,New To Java...
# 8

assuming there is no other field feqnum that is not quoted in the code it MUST !!!!

the following lines

feqnum=new int [5]; //is this some sort of an array?

feqnum[0]=0;

feqnum[1]=0;

feqnum[2]=0;

feqnum[3]=0;

feqnum[4]=0;

will not compile with the code provided, as feqnum has never been declared !

g_magossa at 2007-7-12 2:38:50 > top of Java-index,Java Essentials,New To Java...
# 9

> assuming there is no other field feqnum that is not

> quoted in the code it MUST !!!!

>

> the following lines

> > feqnum=new int [5]; //is this some sort of an array?

> feqnum[0]=0;

> feqnum[1]=0;

> feqnum[2]=0;

> feqnum[3]=0;

> feqnum[4]=0;

>

> will not compile with the code provided, as feqnum

> has never been declared !

I think his point was that you could change all the references to feqnum to freqnum as well, so you don't have to make freqnum feqnum. You could also change them all to bananaPudding. There are lots of way to fix it!

hunter9000a at 2007-7-12 2:38:50 > top of Java-index,Java Essentials,New To Java...
# 10

> assuming there is no other field feqnum that is not

> quoted in the code it MUST !!!!

>

> the following lines

> > feqnum=new int [5]; //is this some sort of an array?

> feqnum[0]=0;

> feqnum[1]=0;

> feqnum[2]=0;

> feqnum[3]=0;

> feqnum[4]=0;

>

> will not compile with the code provided, as feqnum

> has never been declared !

indeed, my mistake. thanks!

georgemca at 2007-7-12 2:38:50 > top of Java-index,Java Essentials,New To Java...
# 11
Waw what a releave i thought i was getting dummer and dummer :)Satanduvel
Satanduvela at 2007-7-12 2:38:50 > top of Java-index,Java Essentials,New To Java...