Java
  Home arrow Java arrow Page 4 - Java and Object-Oriented Programming
CIO Insight
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVA

Java and Object-Oriented Programming
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 8
    2007-09-19

    Table of Contents:
  • Java and Object-Oriented Programming
  • How State and Behavior Affect One Another
  • Class, Inheritance and Interface
  • All About Variables

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
     
    ADVERTISEMENT

    Minimize the cost of deploying database applications. Advantage Database Server or Microsoft SQL Server – Which One is Right for You? Learn now!

    Java and Object-Oriented Programming - All About Variables
    (Page 4 of 4 )

    Variables

    Since we spoke about variables or fields in the Object portion of our tutorial, we'll cover them more in depth here. Java allows for four types of variables. They are as follows:

    Instance Variables are used for storing the individual states of an object.

    Class Variable is a single variable that used for all of the objects within a class.

    Local Variables are used to store temporary states of an object. A local variable is used only within a method and is not usable outside of where it was declared.

    Parameters are always variables, and never fields.

    Variable Naming Conventions

    Just as you can't run around calling everyone "Hey you!" (well you could, but good luck finding the right Hey You in your phone book), you can't simply tell your computer to use "that variable over there with the funny haircut." Below is a list of rules for naming variables.

    1. Names may consist of letters, numbers, dollar signs, and underscores.

    2. It is better to use the full word when naming variables to avoid confusion later on. For instance instead of naming a button b_g, take the time to spell out bubble_gum. When you get a call at three o'clock in the morning because your program isn't working, you'll thank yourself.

    3. To make the names more readable, if it contains two words, always uppercase the first letter of each word. If it is one word, keep it lowercase. (Example: BubbleGum or bubble). And remember: no spaces.

    4. Variable names are case-sensitive. If you name your variable bubble and refer to it later as Bubble, it will not work.

    In the next tutorial on Programming in Java, we will discuss the Data Types of variables (certain variables hold certain types of data) and cover more of the basic language rules.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · Hope you guys enjoyed this article on Java and Beginning Object Oriented...
     

       

    JAVA ARTICLES

    - Introducing the Spring Framework
    - Java Classes
    - Completing the Syntactic Comparison of Java ...
    - Syntactic Comparison of Java and C/C++
    - Java Statements
    - Conditionals, Expressions and Other Java Ope...
    - Java Operators
    - Primitive Data Types and Basic Language Rule...
    - Java and Object-Oriented Programming
    - Java Beginning Programming
    - Gaming Development Setup
    - Using RPC-Style Web Services with J2EE
    - Integrating XML with J2EE
    - Taming Tiger: Concurrent Collections
    - Combating the ‘Object Crisis’

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway