Java
  Home arrow Java arrow Page 3 - Primitive Data Types and Basic Language Rules for Java
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

Primitive Data Types and Basic Language Rules for Java
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 12
    2007-09-24


    Table of Contents:
  • Primitive Data Types and Basic Language Rules for Java
  • Working with Arrays
  • Multidimensional Arrays
  • A Few More Rules

  • 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


    Primitive Data Types and Basic Language Rules for Java - Multidimensional Arrays
    ( Page 3 of 4 )

    If we want to get crazy (and deciding to learn any programming language is a sure indicator that you do), Multidimensional Arrays offer you a way to get there. The following code demonstrates how to declare a two-dimensional array.

    Int YourTwoDimensionalArray [] [] = new int [8] [8];

    What the above code does is give us an 8x8 array. Think of the way a chess board looks: a grid of 8 rows and 8 columns.




















    Each of the above boxes would hold two indexes; the left index is used for the row, the right index is used for column


    When you allocate memory for a multidimensional array, you only have to set memory for the left dimension. You can allocate the right dimension at a later time, as in the following code.

    Int YourTwoDimensionalArray [] [] = new [5] [0]

    YourTwoDimensionalArray[0] = new int [2]

    YourTwoDimensionalArray[0] = new int [7]

    YourTwoDimensionalArray[0] = new int [20]

    YourTwoDimensionalArray[0] = new int [25]

    YourTwoDimensionalArray[0] = new int [12]

    Note also that if you ever need to know the length of an array the following code will print it to your screen:

    System.out.println(YourArray.length);



     
     
    >>> 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 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek