Results 1 to 2 of 2
  1. #1
    krashh205 is offline Member
    Join Date
    Dec 2010
    Posts
    3
    Rep Power
    0

    Default Different ways of creating object

    I noticed 2 ways of creating object.

    First Way
    ========
    BUfferedImage BufferedImageObject= new BufferedImage(60,50,BufferedImage.TYPE_INT_ARGB);



    Second Way
    =========
    BUfferedImage BufferedImageObject= ImageIO.read(new FILE(C:\\Image.jpg));

    I do understand the difference in functionality. That is not a problem. But in the Second Way, we are NOT using the "new" keyword. SO, in the Second way, is an object created????

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,932
    Rep Power
    8

    Default

    Check out the source for ImageIO.read(). I bet it (or something that it calls) creates a new BufferedImage using the "new" keyword. Then the method simply returns that instance.

Similar Threads

  1. creating an object inside jsp using el/jstl
    By niteangell21 in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 11-30-2010, 05:26 PM
  2. Creating a cylinder object
    By b_erten in forum New To Java
    Replies: 8
    Last Post: 07-25-2010, 08:43 PM
  3. Creating an object and getting a value from it
    By BrownBread in forum New To Java
    Replies: 2
    Last Post: 11-30-2008, 06:08 AM
  4. Creating a Comparable object
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-15-2008, 07:38 PM
  5. Creating object of Type Object class
    By venkatv in forum New To Java
    Replies: 3
    Last Post: 07-17-2007, 03:33 PM

Posting Permissions

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