Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Process to do better in Java prgramming

  1. #1
    Junior Member
    Join Date
    Oct 2008
    Location
    bangladesh
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Process to do better in Java prgramming

    I am a new java programmer.so i need help from you about the process that i can do better in java programming.Actually you have to show me the way.


  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: want help

    Hello shawon,

    Welcome to the Java Programming Forums.

    Java is very complex. Its going to take dedication and lots of reading/practise to learn.

    The best place to start is at the Sun Java Tutorials. Its exactly where I started..

    The Java™ Tutorials

    Read all about the basics. Try to write your first "hello world" program and post back here when you get stuck.

    Enjoy.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  3. #3
    Junior Member
    Join Date
    Oct 2008
    Location
    bangladesh
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs down Re: thanks

    Thanks .I am succesful to run first program.But for academic study it is important for me to know about static & it's use,restriction.Actually u have to give me idea with a code.wish ur reply soon.

  4. #4
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: want help

    The static keyword denotes that a member variable, or method, can be accessed without requiring an instantiation of the class to which it belongs.
    In simple terms, it means that you can call a method, even if you've never created the object to which it belongs! Every time you run a stand-alone application (which requires a static main method), the virtual machine can call the main method without creating a new application object. Of course, unless the application's methods are all static, you will need to create an instance of it at some point.
    With regard to member variables, it means that they can be read from, and written to, without creating an object. You may have noticed that many classes create constants that can be read, without creating an object.
    static final int VERSION = 2;

    Static member variables are shared by all instances of the class to which they belong. When writing classes, this can be a handy feature. Consider the following example, where a counter is used to track how many myObject instantiations have taken place.
    public class myObject
    {
    	static int objectCount = 0;
     
    	public myObject()
    	{
    		objectCount++;
    	}
     
    	public String toString()
    	{
    		return new String ("There are " + objectCount + " objects");
    	}
    }

    As each new myObject is created, the counter increments. If you were writing an Internet server application, you could track how many concurrent connections existed (remembering that you'd have to include in the destructor or at the end of the connection code a decrement to your count). When used correctly, static member variables and methods can be quite useful!
    Being new to Java your probably finding this quite hard to understand. There is lots and lots of information out there. Id suggest looking through Google because you will find a lot of indepth explanations that will save us both time. Read as much as you can, try different examples until you truely understand what static means.

    It all comes together quite nicely once you start writing your own code..

    There are some free SCJP ebooks on this site that will be really worth reading and will help you alot in your study.

    http://www.javaprogrammingforums.com...questions.html
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.