java ques

Sharky Forums


Results 1 to 4 of 4

Thread: java ques

  1. #1
    Reef Shark
    Join Date
    Sep 2001
    Location
    Canada
    Posts
    268

    java ques

    -what is the difference in identity and equality in programming. my proff pointed on this topic and is getting it in midterm.
    -what are wrapper class? and what do they do? and how do we create them?


    Thank you very much

  2. #2
    Reef Shark bocybo's Avatar
    Join Date
    Sep 2002
    Location
    Texas
    Posts
    280
    Well, a wrapper class is like a convinience class for complicated and generally technical routines that you might want to run that helps remove clutter from your main files. For example, you might create a wrapper class for graphics that contains draw_rectangle and draw_triangle methods, instead of writing the code over and over again in your main program. In essence, a wrapper class "wraps" around long code to compress what you need to write in your main files.

    I'm not sure if I understand the first question correctly, but I beleive that equality would be comparing two seperate data types or objects to see if they are syntactically equal, and identity would be checking to see if something is(or is an direct version of) itself. Hope this helps.
    Reed's sister is sooo hot!

  3. #3
    Reef Shark Blue_MiSfit's Avatar
    Join Date
    Sep 2001
    Location
    Santa Cruz, CA
    Posts
    311
    A simple example of a wrapper class is BufferedReader. It can wrap around any of several readers, like FileReader, and it provides simple methods like read() and readLine(). This greatly simplifies simple text input procedures.

    Just a little note from a first year CE major
    ~misfit
    Mein Komp
    Antec P180 w/ 450w Antec PSU
    ECS KN1 SLI Extreme w/ Zalman passive NB cooler
    Athlon 64 3500+ Venice w/ Zalman cooler
    eVGA 7800GT CO PCIe
    1GB DDR400
    1x 80 GB IDE, 1x 120GB SATA , 2x 250GB SATA
    16x DL LiteOn DVD+/-RW
    Sony G500 Trinitron 21" CRT 1280x960@96Hz
    Klipsch ProMedia 5.1's on Audigy2 ZS
    Windows XP Pro SP2

  4. #4
    Thread Killer Delphi00's Avatar
    Join Date
    Jun 2003
    Location
    Bay Area, CA
    Posts
    3,327
    For your first question, you basically asking what's the difference between "=" and "=="?

    The first one ("=") is most often used to assign values to a variable such as:

    int NoOfHands = 2;

    The Second one ("==") is used to compare to values to see if the are equal and return a boolean value such as:

    10 == 12 is false
    Rig:
    P4 2.4C @ 3.0Ghz | Abit IC7 | Thermalright SLK 947U + Enermax 90mm | Scythe Ultra Kaze 120mm | Corsair 3GB | PowerColor HD3850 AGP | Antec SLK3700AMB | Enermax Whisper II 535W | Hercules Fortissimo III 7.1 | Samsung 931B | Logitech Z-2300 | WinXP Pro

Posting Permissions

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