Java
  Home arrow Java arrow Page 2 - Java and Object-Oriented Programming
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
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? 
Google.com  
JAVA

Java and Object-Oriented Programming
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 9
    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:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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


    Java and Object-Oriented Programming - How State and Behavior Affect One Another
    ( Page 2 of 4 )

    Simply put, when you change the state of an object, you ask it to perform a behavior. An object stores its states in a field (commonly referred to as variables, which will be discussed in further depth later) and demonstrates its behaviors through methods (known as functions, also covered later).

    When you press the power button on your computer, it places it in the On state. Because we have changed the state of the computer (from Off to On), we have also initiated certain behaviors from the computer. In this case, the power comes on, the fans within the computer turn on, and the system bios, followed the hard drive, etc. all become active.

    Note that an object can only have the states and behaviors you place upon it. I cannot press the on button of my computer and receive a bologna sandwich unless the programmer coded that in. (Note to self: add bologna sandwich dispenser to computer).

    Benefits of Objects

    Aside from being shiny and fun to look at, objects within a program offer several benefits.

    1. Modularity: You can write the code for the object within the object itself, keeping it separate from other coding, while still being able to call upon it at any time.

    2. Hiding Information: Planting your code within your object makes it less visible to the user.

    3. Reuseability: Once created, an object can be copied and used again and again without having to go through the process of remaking it.

    4. Debugging Made Simple: Objects make debugging easier in some instances. If you track the problem to a button within your application, you can simply remove the button and remake it, instead of having to delve into your main code.



     
     
    >>> More Java Articles          >>> More By James Payne
     

       

    JAVA ARTICLES

    - Exception Handling Techniques in Java
    - More About Multithreading in Java
    - The Basics of Multiple Threads in Java
    - Data Access Using Spring Framework JDBC
    - New Object Initialization in Java
    - Adding Images With iTextSharp
    - Adding Columns With iTextSharp
    - Creating Simple PDF Files With iTextSharp
    - The Spring Framework: Understanding IoC
    - 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...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek