On the P800 you have its MIDP 1.0 or PersonalJava (pJava) as options.
On the PocketPC it'll depend on whose Java implementation (Insignia or whatever) you have installed on it as Microsoft isn't shipping one as part of the OS (and I don't think many/any PocketPC hardware manufacturers are adding Java either).
See the respective Java SDK's (Software Development Kits) for what can and cannot be done.