Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-27-2008, 02:26 PM
Member
 
Join Date: Jun 2008
Posts: 26
MarkWilson is on a distinguished road
About static variable
Hi
how many times i can declare static variable in my program
what about --public static void main -- here in every program we are declare main as static . how thy work
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-27-2008, 02:29 PM
Senior Member
 
Join Date: Jun 2008
Posts: 181
masijade is on a distinguished road
You can declare as many static fields as you wish (which has nothing to do with a static method, BTW). "how thy work" is that there is only one copy of them that all instances of (and references to) that Class use.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 06-27-2008, 02:35 PM
Member
 
Join Date: Jun 2008
Posts: 26
MarkWilson is on a distinguished road
is Java 100%
see dear friends ,

actually java is not 100%pure oo language because of Primitive data types

and we can use the Wrapper class in java to use Primitive data types

so as compare with the C++ how u can say that " C++ is object oriented pure and Java is not "

please maintain some example so ican clear my dought?
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 06-27-2008, 02:38 PM
Senior Member
 
Join Date: Jun 2008
Posts: 181
masijade is on a distinguished road
Quote:
Originally Posted by MarkWilson View Post
see dear friends ,

actually java is not 100%pure oo language because of Primitive data types

and we can use the Wrapper class in java to use Primitive data types

so as compare with the C++ how u can say that " C++ is object oriented pure and Java is not "

please maintain some example so ican clear my dought?
Maybe you meant to post this in a different thread (or maybe start a new one) since it doesn't have anything to do with the rest of it.

But, in any case, C++ is much less pure than Java, not more. But it is a silly question anyway, as there is no defined "purity" scale for OO anyway, so the question is meaningless.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 06-27-2008, 02:39 PM
Member
 
Join Date: Jun 2008
Posts: 26
MarkWilson is on a distinguished road
ya see in single program i am declaring psvm (string args )
and also using static for some other method at that situation wht i can do? and they are using same class with same instance.
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 06-27-2008, 02:43 PM
Senior Member
 
Join Date: Jun 2008
Posts: 181
masijade is on a distinguished road
It might help if you posted the pieces of code in question and explain what the actual problem is rather than beating around the bush here.

Edit: And use code tags when you do post code.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Explicit static initialization with the static clause Java Tip java.lang 0 04-17-2008 12:07 AM
Error: Non-static method append(char) cannot be referenced from a static context paul Advanced Java 1 08-07-2007 06:05 AM
Error: non-static variable height cannot be referenced from a static context at line fernando AWT / Swing 1 08-01-2007 10:25 PM
non-static member can not be referenced from a static context christina New To Java 1 07-31-2007 07:11 PM
Help with static variable counter silvia New To Java 1 07-19-2007 08:53 PM


All times are GMT +3. The time now is 03:56 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org