×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    40

    Question New Thread: Code explanation required pls

    Please I'm finding it difficult to understand why this piece of code works, I knw wat it does but I dont knw why it works based on something i think is a flaw (but definitely isnt, just that i dont grab whats happened)...Please can i get some explanantion. Thanx (pls note, i'm new to j2me)...this is the code:
    ***************************************************************
    private void initialize() {
    javax.microedition.lcdui.Display.getDisplay(this).setCurrent(get_helloTextBox());
    }
    ***************************************************************
    line 2 of that code calls the getDisplay() method on a class, not on the object of class Display (from lcdui package). How does this work? Is it possible to call a method on a class or does it see javax.microedition.lcdui.Display as an object. Any explanations?...Thanx

  2. #2
    Nokia Developer Expert
    Join Date
    May 2007
    Location
    Mexico D.F
    Posts
    351

    Re: New Thread: Code explanation required pls

    It is because getDisplay is a static method, it means no instance of the class is required, just the name of the class. Is a basic concept of Object Oriented Programming. You need to check that.
    :Ruben

  3. #3
    Registered User
    Join Date
    Nov 2008
    Posts
    40

    Re: New Thread: Code explanation required pls

    Thanx, verified that over the web.

Similar Threads

  1. implementing code...help pls!
    By f.dedominicis in forum Symbian
    Replies: 0
    Last Post: 2007-04-08, 22:52
  2. s40 registration code need pls help me
    By kithmina in forum Symbian
    Replies: 1
    Last Post: 2006-06-28, 11:12

Posting Permissions

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