Java Question about Casting

HiCan anybody explain what’s happening in following line wit object (DateTime) on the left hand.

What does Casting Mean, anbody have a good explaination??

DateTime dt=(DateTime)mvCurdoc.getItemValueDateTimeArray(“DueDateTime”).elementAt(0);

Subject: Java Question about Casting

Document.getItemValueDateTimeArray will return a Vector of generic Java objects. Java does not know whether this is a DateTime or not unless you explicitly tell it through the (DateTime) cast. What you’re effectively doing is taking an object and converting it to a DateTime object before assigning it.

Hope this makes sense!

Pete

Subject: RE: Java Question about Casting

Actually “converting” is probably the wrong word. Its already a DateTime object. What you’re actually doing is confirming to Java that thats what it is cos otherwise it won’t recgnise it. Guess its a bit like showing someone a picture of a badly drawn tree…so bad that they can’t recognise it but if you write TREE above it in big letters then they know what it’s meant to be :slight_smile:

Subject: Thanks It dit make sense[EOM]