Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: How do I set a static variable??

Threaded View

  1. #1
    Junior Member
    Join Date
    Dec 2009
    Posts
    10
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default How do I set a static variable??

    Hi all.

    I'm working on a problem for a school project.

    Bascially I have to set a static variable within a class. I have declared the variable as follows:-
    private static Horse theLeadingHorse;
    I now have to get and set this static variable by using two class methods. The setter has to be declared as private and the getter as public.

    how do I do this??? I have been racking my brains for hours now but no luck!! it's really starting to do my head in.

    Basically the getter class method has to return the variable and the setter class method has to set this horse as the leader (ie. the winner).

    Anyone any ideas or suggestions?????

    Any help would be greatly appreciated.

    thanks in advance

    John
    Last edited by helloworld922; January 20th, 2010 at 01:12 PM.


Similar Threads

  1. Static to non-static - Organization
    By copeg in forum Object Oriented Programming
    Replies: 5
    Last Post: December 22nd, 2009, 01:56 PM
  2. static final object
    By kalees in forum Object Oriented Programming
    Replies: 3
    Last Post: December 21st, 2009, 12:29 PM
  3. quite small (make the changelog non-static, i.e. load its content from a file)
    By Abdallah in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: November 30th, 2009, 09:00 PM
  4. Static method
    By kalees in forum What's Wrong With My Code?
    Replies: 4
    Last Post: November 20th, 2009, 11:10 AM
  5. Calling a void method into a static void main within same class
    By sketch_flygirl in forum Object Oriented Programming
    Replies: 3
    Last Post: November 15th, 2009, 05:24 PM