Results 1 to 3 of 3
  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
    4

    Default Final variables in method

    I have another doubt..
    1.can we declare final variables in a class outside a method
    example: public class A { final xxx xxxx; --methods{}//end of methods-- }//end of class
    2.can we declare static variables in a class outside a method
    3.can we declare public variables in a class outside a method

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    18,333
    Rep Power
    27

    Default Re: Final variables in method

    What does the compiler say when you try those things?

    Code a small test program and try them.

  3. #3
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,045
    Blog Entries
    7
    Rep Power
    23

    Default Re: Final variables in method

    Please don't ask your questions in two separate threads. I'll close the other thread.

    kind regards,

    Jos
    The only person who got everything done by Friday was Robinson Crusoe.

Similar Threads

  1. Final variables shouldn't also be static?
    By emilioJazz in forum Advanced Java
    Replies: 5
    Last Post: 11-29-2010, 12:10 PM
  2. Final variable-constructor method.
    By D4rkNrG in forum New To Java
    Replies: 9
    Last Post: 10-13-2010, 11:18 AM
  3. final variables in abstract classes
    By parulmahajan in forum New To Java
    Replies: 4
    Last Post: 06-11-2010, 09:54 AM
  4. Using final with method arguments
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-17-2008, 07:48 PM
  5. Method with final keyword
    By javaplus in forum New To Java
    Replies: 2
    Last Post: 11-29-2007, 10:39 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
  •