CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 1999
    Location
    Australia, Melbourne
    Posts
    10

    Referencing with respect to java

    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


  2. #2
    Join Date
    May 1999
    Location
    Pune, MH, India.
    Posts
    453

    Re: Referencing with respect to java

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured