Java
  Home arrow Java arrow Page 2 - Java and Object-Oriented Programming
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

    Dell PowerEdge Servers

    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


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

       

    JAVA ARTICLES

    - 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...
    - 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

     
    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 1 hosted by Hostway