Before the code, firstly, thanks for all of the prompt replies.
Next, I reckon that my classpath is correct. Path points to the only place I keep code and classpath is to the version of java I am using.
Firstly, arm:
/**
*Author Keith Stansbie
*A simple class to make arms for the human
**/
import java.util.*;
public class Arm{
boolean side; //true is right, false is left
int nailLength; //length of nails
boolean tan; //is arm tanned?
protected Arm(boolean side, int nailLength, boolean tan){
this.side = side;
this.nailLength = nailLength;
this.tan = tan;
}
//Method to grow nails
public void nailgrow(){
nailLength++;
}
}
Next, leg:
/**
*Author Keith Stansbie
*A simple class to make legs for the human
**/
import java.util.*;
public class Leg{
boolean side; //true is right, false is left
int location; //position of leg
int length; //length of leg
protected Leg(boolean side, int location, int length){
this.side = side;
this.location = location;
this.length = length;
}
//Method to move leg
public void move(){
location++;
}
}
Now a head:
/**
* @author Keith Stansbie
* A simple class to make a new head for the humam
**/
import java.util.*;
public class Head{
String eyeColour;
String hairColour;
boolean piercedEar;
/**
* @param EyeColour the colour of the eyes.
* @param HairColour the colour of the hair.
* @param Set piercedEar to true or false.
**/
protected Head(String eyeColour, String hairColour, boolean piercedEar){
this.eyeColour = eyeColour;
this.hairColour = hairColour;
this.piercedEar = piercedEar;
}
}
And this is the Human:
/**
* A simple class to make a human
*@author Keith Stansbie
**/
import java.util.*;
import java.io.*;
public class Human{
public Head head;
public Arm rightArm;
public Arm leftArm;
public Leg rightLeg;
public Leg leftLeg;
public Human(Head myHead, Arm myLeftArm, Arm myRightArm, Leg myLeftLeg, Leg myRightLeg){
this.head = myHead;
this.rightArm = myRightArm;
this.leftArm = myLeftArm;
this.leftLeg = myLeftLeg;
this.rightLeg = myRightLeg;
}
public void walk(int step){
for(int j=0; j<=step; j++){
// Call the move method from the Leg class.
leftLeg.move();
rightLeg.move();
}
}
public static void main(String[] args){
/**
* This makes new arms,legs and head classes
**/
Head myHead = new Head("Blue","Grey",true);
Arm myLeftArm = new Arm(true,6,false);
Arm myRightArm = new Arm(true,6,false);
Leg myLeftLeg = new Leg(false,0,9);
Leg myRightLeg = new Leg(false,0,9);
/**
* Make a new Human Class and add the arms,legs,and head object
* to the human class
**/
Human me = new Human(myHead,myLeftArm,myRightArm,myLeftLeg,myRightLeg);
}
}
All 4 classes are in the same package inside the folder where I keep my code. I have tried with the package statement at the start of each to no effect. I have checked the filename of each class and they are Leg, Arm, Head (all of which compile, BTW) and Human. All.java and all capitalised.
Sorry if the formatting is mucked up with the copy/paste.
Also apologies for the long post - but i was asked for the code
FWIW, I think that it is one of those glaringly ridiculous errors that only one who has spent days looking (as I have) could possibly miss
K