Hi Kobweb
Can you be more specific? What exactly do you need to do?
Concerning your class, I would write something like:
public class Person {
private String name;
private int age;
public Person( String aName, int fAge ){
this.name = aName;
this.age = fAge;
}
public void setName( String aName ){ this.name = aName; }
public void setAge( int fAge ){ this.age = fAge; }
public String getName(){ return this.name; }
public int getAge(){ return this.age; }
}
but I'm still not sure about what you call "to pass data types within a
class".
Hope it help
mihai
Kobweb Admin a écrit :
Hi I would just like to know how to pass data types within a class.
For example
The program however must use the two instance variables to take the
name and age of two people usiing only those instance variables.
public class Person
{
private String name;
private int age;
public Person (aName,fAge)
{
this.name=aName;
this.age=aAge;
}
}
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en