• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can i use "static" variable as parameters?

 
Hari Kumarkar
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can i use "static" variable as parameters? If yes i would be appreciate if i have an example.

Thanks & Regards
Hari
 
Dragan Stankovic
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean something like this:



If so then answer is: yes you can, but depending on the problem you are trying to solve maybe defining them doesn't have much sense. For what case you actually plan to use this?
[ November 06, 2008: Message edited by: Dragan Stankovic ]
 
Rob Spoor
Sheriff
Pie
Posts: 20514
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Dragan Stankovic:
If so then answer is: yes you can, but it doesn't make much sense. For what case you actually plan to use this?

Please check the Java API. Static "variables" (a.k.a. constants ) are used as arguments all over the place. As a good example, check java.awt.BorderLayout. When specifying the constraints for a component you use one of those constants:
 
Hari Kumarkar
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dragan Stankovic , Rob Prime

I came to know usage of static as parameters.

Thank You very much
 
arulk pillai
Author
Ranch Hand
Posts: 3387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



static final variables are know as constants.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Hari Kumarkar:
Hi Dragan Stankovic , Rob Prime

I came to know usage of static as parameters.

Thank You very much


static as parameters! you can't give something like this

 
Rob Spoor
Sheriff
Pie
Posts: 20514
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by arulk pillai:



static final variables are know as constants.

You are right of course.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic