Your code miss a few important things but the first thing you want to do is to either cast the value returned by Iterator.next() call (missing in your code) or use generics to have the compiler sort it out for you.
The two alternatives would look something like this (didn't try to compile them but they should be mostly right):
With cast:
ArrayList array = new ArrayList();
...
Iterator it1 = array.iterator();
while (it1.hasNext()){
Myclass temp = (Myclass)it1.next()
System.out.println (temp);
}
With generics:
ArrayList<Myclass> array = new ArrayList<Myclass>();
...
Iterator<Myclass> it1 = array.iterator();
while (it1.hasNext()){
Myclass temp = it1.next()
System.out.println (temp);
}
Edit: As someone else points out, using the foreach construct is in most cases preferable for readability. I decided to just modify your initial code as little as possible. A for construct would look like this:
ArrayList<Myclass> array = new ArrayList<Myclass>();
...
for(Myclass temp : array){
System.out.println (temp);
}