File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Can i use Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Can i use "static" variable as parameters?" Watch "Can i use "static" variable as parameters?" New topic
Author

Can i use "static" variable as parameters?

Hari Kumarkar
Greenhorn

Joined: Aug 11, 2006
Posts: 19
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

Joined: Oct 14, 2008
Posts: 33
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 ]

http://www.expertaya.com
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19725
    
  20

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:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Hari Kumarkar
Greenhorn

Joined: Aug 11, 2006
Posts: 19
Hi Dragan Stankovic , Rob Prime

I came to know usage of static as parameters.

Thank You very much
arulk pillai
Author
Ranch Hand

Joined: May 31, 2007
Posts: 3223



static final variables are know as constants.


Java Interview Questions and Answers Blog | Amazon.com profile | Java Interview Books
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

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

Joined: Oct 27, 2005
Posts: 19725
    
  20

Originally posted by arulk pillai:



static final variables are know as constants.

You are right of course.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can i use "static" variable as parameters?