View Single Post
Old Jun 5th, 2005, 5:24 PM   #2
Pilgrim
Newbie
 
Join Date: Jun 2005
Posts: 11
Rep Power: 0 Pilgrim is on a distinguished road
As to your first question, in Java a program is contained in a class. The primary purpose of a class is to define and manipulate an object you would like to create. For example,

public class Cow
{
     public int age;
     public String color;
 
     public Cow()
     {
          age = 3;
          color = "red";
     }

     public void graze()
     {
      ......

Now, I don't know how much you know about java, but hopefully my code segment can be somewhat helpful. Above, I have created a Cow class. The public Cow() is a constructor that defines what variables make up a Cow object. The graze method is an example of a method that could be applied to a Cow object.

Anyway, I don't know how helpful this was, but I hope it helped. I can explain things more if necessary.
Pilgrim is offline   Reply With Quote