Basically I have:
A main class:
public class mainClass { public static void main(String[] args) { extraClass First=new extraClass("First",1,true); extraClass Second=new extraClass("Second",2,true); extraClass Third=new extraClass("Third",3,false); extraClass.compareObjects(First,Second); } }
And an extraClass:
public class extraClass { private String objectName; private int objectID; private Boolean isUsed; public extraClass(String tempName,int tempID,Boolean tempUsed) { objectName=tempName; objectID=tempID; isUsed=tempUsed; } public static void compareObjects(extraClass objectOne,extraClass objectTwo) { if (((objectOne.objectName.equalsIgnoreCase("First")&&(objectTwo.objectName.equalsIgnoreCase("Second"))) || (objectOne.objectName.equalsIgnoreCase("Second"))&&(objectTwo.objectName.equalsIgnoreCase("First"))) && (!Third.checkUsed)) { Third.setUsed(Third); System.out.println("Yeah"); } } public Boolean checkUsed(extraClass tempName) { if (tempName.isUsed) return true; else return false; } public void setUsed(extraClass tempName) { tempName.isUsed=true; } }
I'm given the errors:
cannot find symbol variable Third
cannot find symbol variable Third
cannot find symbol variable Third
The problem is in the compareObjects method in the extraClass when I attempt to use an object I created in the mainClass using the extraClass.
Any ideas?