Results 1 to 2 of 2
  1. #1
    spatel14 is offline Member
    Join Date
    Apr 2010
    Posts
    28
    Rep Power
    0

    Default Access Public Global Variables in class

    I wrote a class Ex1 that has a public double variable. It's global, therefore it's defined outside of any method. Now, can I get access to this variable in another class, called Ex2? If so, what is the syntax to do this? For example, if I make an new instance of Ex1 inside of Ex2, can I access these variables since they are not method?

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

Similar Threads

  1. Access Public Global Variables in class
    By spatel14 in forum New To Java
    Replies: 5
    Last Post: 07-08-2010, 10:50 AM
  2. Replies: 4
    Last Post: 10-22-2009, 05:45 PM
  3. Replies: 3
    Last Post: 03-14-2009, 07:22 AM
  4. global variables
    By blackstormattack in forum New To Java
    Replies: 1
    Last Post: 03-08-2009, 07:19 PM
  5. Declaring global variables
    By eva in forum New To Java
    Replies: 3
    Last Post: 12-23-2007, 12:11 AM

Posting Permissions

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