This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes instantiating a static object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "instantiating a static object" Watch "instantiating a static object" New topic

instantiating a static object

Kondapally Ashwin

Joined: May 16, 2006
Posts: 25

I came across a code which is something like this..

static Test A = new Test() where Test is a class. I am not able to understand the reason for using the static keyword here. I want to know what purpose it serves.

Thanks in advance.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15045

'static' means in this case that the variable A is a static member variable.

See: The Java Tutorial - Understanding Instance and Class Members
[ September 19, 2007: Message edited by: Jesper Young ]

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
I agree. Here's the link:
subject: instantiating a static object
It's not a secret anymore!