Is there any way that i can give a version number to my application in netbeans.And then access that version number inside my code.
Something similar to the Assembly num
I don't know about .NET assembly numbers, but if you're creating a web application you can certainly put a version number into the manifest of your WAR file.
Any Java package can have a build info text file added to it so you can tell these things.
Your version number could be a build number from Ant, a version number from Subversion, or a combination of the two.