let $x :=
<root>
<ACTS>
<ACT>Play</ACT>
<A>
<Day>1</Day>
<time>Fri Feb 28 13:21:42 IST 2014</time>
</A>
<A>
<Day>2</Day>
<time>Fri Feb 28 13:21:43 IST 2014</time>
</A>
</ACTS>
<ACTS>
<ACT>Study</ACT>
<A>
<Day>1</Day>
<time>Fri Feb 28 13:21:42 IST 2014</time>
</A>
<A>
<Day>2</Day>
<time>Fri Feb 28 13:21:43 IST 2014</time>
</A>
<A>
<Day>3</Day>
<time>Fri Feb 28 13:21:43 IST 2014</time>
</A>
</ACTS>
</root>
XQuery -
let $maxDay := max($x//ACTS[ACT="Study"]/A/Day)
for $y in $x//ACTS[ACT/text()="Study"]/A[Day/text()=$maxDay]/time
return $y
XPath -
//ACTS[ACT/text()="Study"]/A[Day/text()=max(//ACTS[ACT="Study"]/A/Day)]/time
You said - "someone please guide me xquery and its usage in java for this.. "
For this please refer following posts -
Assuming your Java code is right, I think, your XPath expression put you in the mess. BTW, above links would guide you for the correctness of Java code.
You asked - "which is best in this situation xquery or xpath. "
Google for "Difference between XQuery and XPath", and you will get the answer.
HTH :)