Re: java beginnings
- From: Roedy Green <see_website@xxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 30 Sep 2007 01:54:39 GMT
On Sat, 29 Sep 2007 11:20:04 -0700, cusickgeorge@xxxxxxxxxxx wrote,
quoted or indirectly quoted someone who said :
public class Cat
{
private int[] carId;
private int[] makerId;
/**
* Creates a new instance of Cat
*/
public Cat(int[] anCarId, int[] aMakerId)
{
}
I think you are asking how does the Cat constructor record for
posterity the values of the parameters.
public Cat(int[] anCarId, int[] aMakerId)
{
this.carId = anCarId,
this.makerId = aMakerId;
}
Usually you name your parm and instance variable
the same like this:
public class Cat
{
private int[] carId;
private int[] makerId;
public Cat(int[] carId , int[] makerId )
{
this.carId = carId ,
this.makerId = makerId ;
}
}
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
.
- References:
- java beginnings
- From: cusickgeorge
- java beginnings
- Prev by Date: generics and arrays and multi-class collections
- Next by Date: Re: nullPointerException in abstract class
- Previous by thread: java beginnings
- Next by thread: java tips
- Index(es):