Click to See Complete Forum and Search --> : Referencing with respect to java


Chrisfl
August 24th, 1999, 01:07 AM
How do you reference an object and then typecast the object to something else???

What i am trying to do is to pass an object to a function to be filled, ie (I need a pointer equalivant to C++) so that I can typecast a object to a byte array.

The object that I am dealing with is the PRINTER_INFO_2 class


So what i need is a method to convert an object of this type to a byte array.

Or is their an easier way of doing this kind of thing in java

Please help,

Chris

unicman
August 24th, 1999, 08:01 AM
Look at this code...

[javcode]
public class rnd
{
public static void main( String arg[] )
{
Object rr = new byte[] { 0,0,0 };

System.out.println( rr );

System.out.println( ((byte[])rr)[0] );
}
}
[/javacode]

It works on my machine.

- UnicMan