how to access object of one class in another class

Discussion in 'Java' started by xodepp shrestha, Feb 20, 2013.

  1. i am having problem in JDBC.there are two different class within same package name.one class is dbconnect and another is login. I need to call the dbconnect class within login class and i need to call the connection object from the dbconnect class in the login class.
    Please help me
     
    xodepp shrestha, Feb 20, 2013
    #1
    1. Advertising

  2. On 02/20/2013 04:04 AM, xodepp shrestha wrote:
    > i am having problem in JDBC.there are two different class within same package name.one class is dbconnect and another is login. I need to call the dbconnect class within login class and i need to call the connection object from the dbconnect class in the login class.
    > Please help me
    >

    Start here: http://docs.oracle.com/javase/tutorial/

    Part of what you need is specifically
    http://docs.oracle.com/javase/tutorial/java/index.html, and even more
    specifically http://docs.oracle.com/javase/tutorial/java/javaOO/index.html.

    A newsgroup works best for targeted questions. If you don't know barely
    anything about a subject you need to read books and tutorials.

    AHS
     
    Arved Sandstrom, Feb 20, 2013
    #2
    1. Advertising

  3. xodepp shrestha

    Lew Guest

    xodepp shrestha wrote:
    > i [sic] am having problem in JDBC.there are two different class[es] within same package name.one class is dbconnect and another is login. I need to call the dbconnect class within login class and i [sic] need to call the connection object from the dbconnect class in the login class.


    You don't call classes in Java, you call methods.

    You don't call objects in Java, you call methods.

    What methods did you need to call?

    I'm betting you spelled those class names wrong. If you created those classes,
    then you failed to follow the Java naming conventions.

    Spelling is crucial in Java, and the conventions are important.

    Please provide an SSCCE.
    http://sscce.org/

    Arved's right. You need to start from the beginning. There's a lot of
    material available for free, just an online search away.

    --
    Lew
     
    Lew, Feb 20, 2013
    #3
  4. On Wed, 20 Feb 2013 05:27:19 -0400, Arved Sandstrom
    <> wrote:

    >On 02/20/2013 04:04 AM, xodepp shrestha wrote:
    >> i am having problem in JDBC.there are two different class within same package name.one class is dbconnect and another is login. I need to call the dbconnect class within login class and i need to call the connection object from the dbconnect class in the login class.
    >> Please help me
    >>

    >Start here: http://docs.oracle.com/javase/tutorial/
    >
    >Part of what you need is specifically
    >http://docs.oracle.com/javase/tutorial/java/index.html, and even more
    >specifically http://docs.oracle.com/javase/tutorial/java/javaOO/index.html.
    >
    >A newsgroup works best for targeted questions. If you don't know barely
    >anything about a subject you need to read books and tutorials.


    And a newsgroup is great for finding out about the good books and
    tutorials.

    Sincerely,

    Gene Wirchenko
     
    Gene Wirchenko, Feb 21, 2013
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. qwerty
    Replies:
    3
    Views:
    9,290
    Scott Allen
    Sep 30, 2004
  2. loveNUNO
    Replies:
    2
    Views:
    926
    loveNUNO
    Nov 20, 2003
  3. Stewart Midwinter
    Replies:
    5
    Views:
    325
  4. Robert Cohen
    Replies:
    3
    Views:
    279
    Andrew Durstewitz
    Jul 15, 2003
  5. Sparhawk
    Replies:
    5
    Views:
    119
    Harag
    Aug 29, 2004
Loading...

Share This Page