Results 1 to 9 of 9
  1. #1
    noobplus's Avatar
    noobplus is offline Senior Member
    Join Date
    Feb 2012
    Location
    chennai,south of India(south east of asia)
    Posts
    232
    Rep Power
    3

    Angry accessing class methods or fields or variables

    hi
    i have a similar problem.. I just want to access a data from another class through inheritance, and don't know, where to declare the accessed variable lol .. I'm pasting my program codes..
    import java.io.*;
    import java.util.*;
    public class inheritance extends bb{

    public static void main() {
    int a=1;
    System.out.println("a is "+a+"b is"+b);
    }
    class bb {
    int b=2;

    }
    }

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,457
    Blog Entries
    7
    Rep Power
    20

    Default Re: accessing class methods or fields or variables

    Read my reply in the thread you were trying to hijack (it was too late, I know, I know ...)

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    noobplus's Avatar
    noobplus is offline Senior Member
    Join Date
    Feb 2012
    Location
    chennai,south of India(south east of asia)
    Posts
    232
    Rep Power
    3

    Default Re: accessing class methods or fields or variables

    haha i repied to that thread that day kinda "tyvm for the explanation" but had network problems :P

  4. #4
    noobplus's Avatar
    noobplus is offline Senior Member
    Join Date
    Feb 2012
    Location
    chennai,south of India(south east of asia)
    Posts
    232
    Rep Power
    3

    Default Re: accessing class methods or fields or variables

    Quote Originally Posted by JosAH View Post
    Read my reply in the thread you were trying to hijack (it was too late, I know, I know ...)

    kind regards,

    Jos
    did u just rank me for hijacking? imma java noob, lol

  5. #5
    noobplus's Avatar
    noobplus is offline Senior Member
    Join Date
    Feb 2012
    Location
    chennai,south of India(south east of asia)
    Posts
    232
    Rep Power
    3

    Default Re: accessing class methods or fields or variables

    i quit man. r u gonna bully meh still and when do i get my answers?

  6. #6
    noobplus's Avatar
    noobplus is offline Senior Member
    Join Date
    Feb 2012
    Location
    chennai,south of India(south east of asia)
    Posts
    232
    Rep Power
    3

    Default Re: accessing class methods or fields or variables

    what did i hijack, i dint understand

  7. #7
    noobplus's Avatar
    noobplus is offline Senior Member
    Join Date
    Feb 2012
    Location
    chennai,south of India(south east of asia)
    Posts
    232
    Rep Power
    3

    Default Re: accessing class methods or fields or variables

    sorry and thanks man i saw your reply in the other thread

  8. #8
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,457
    Blog Entries
    7
    Rep Power
    20

    Default Re: accessing class methods or fields or variables

    Quote Originally Posted by noobplus View Post
    i quit man. r u gonna bully meh still and when do i get my answers?
    I'm not bullying you and I won't do so if you don't post your questions in several threads (hijacked or not). For now I'm trying to close the hijacked threads (if it doesn't disturb any living discussion in it) and I'll clean up wherever needed. Please try to keep this forum tidy.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  9. #9
    noobplus's Avatar
    noobplus is offline Senior Member
    Join Date
    Feb 2012
    Location
    chennai,south of India(south east of asia)
    Posts
    232
    Rep Power
    3

    Default Re: accessing class methods or fields or variables

    Quote Originally Posted by JosAH View Post
    I'm not bullying you and I won't do so if you don't post your questions in several threads (hijacked or not). For now I'm trying to close the hijacked threads (if it doesn't disturb any living discussion in it) and I'll clean up wherever needed. Please try to keep this forum tidy.

    kind regards,

    Jos
    actuly that guy ranked "moderator" was asking meh to post in a new thread , thats what
    Last edited by noobplus; 03-12-2012 at 01:36 PM. Reason: adding my signature

Similar Threads

  1. Accessing variables from another class
    By tti123 in forum New To Java
    Replies: 3
    Last Post: 01-23-2011, 04:43 AM
  2. Accessing Variables From a Different Class?
    By Sterling in forum New To Java
    Replies: 1
    Last Post: 04-08-2010, 05:01 PM
  3. Replies: 3
    Last Post: 03-24-2010, 12:24 AM
  4. Replies: 2
    Last Post: 03-08-2010, 10:29 AM
  5. accessing instance variables from static methods
    By ravian in forum New To Java
    Replies: 7
    Last Post: 03-01-2009, 10:09 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
  •