Results 1 to 4 of 4
Thread: Need observation of this code.
- 08-25-2011, 08:32 AM #1
Member
- Join Date
- Aug 2011
- Posts
- 1
- Rep Power
- 0
Need observation of this code.
Can anyone explain what this code about, by line?
Java Code:public class JavaTwoDimensionArray{ /** Creates a new instance of JavaTwoDimensionArray */ public JavaTwoDimensionArray(){ } public static void main(String[] args){ //Declare and create two dimensional int array whose size is //10 by 5 int[][] ages = new int[10][5]; //Display the number of rows and columns System.out.println("ages.length = " + ages.length); System.out.println("ages[1].length = " + ages[1].length); //Display the value of each entry in the array for( int i=0; i<ages.length; i++){ System.out.println("\nStarting row " + i); for( int j=0; j<ages[i].length; j++){ ages[i][j] = i * j; System.out.print(ages [i][j] + ""); } } } }
- 08-25-2011, 08:45 AM #2
-- redundant no-arg constructor
-- really really bad formatting, read Code Conventions for the Java(TM) Programming Language: Contents
-- do your own homework and you won't need someone to provide an explanation of borrowed code, go through The Java™ Tutorials
-- heck, the largely redundant comments already explain what the code is supposed to do
db
- 08-25-2011, 11:40 PM #3
Arrrrgh!Java Code:System.out.print(ages [i][j] + "");
Kill the redundant code. Kill it now!
-
Similar Threads
-
My code was not executed properly.It will jumping to exception handling.my code is
By vinay4051 in forum EclipseReplies: 3Last Post: 08-10-2011, 09:17 AM -
servlet include method copying sorce code and executing source code as output how to
By shamkuma2k in forum Advanced JavaReplies: 0Last Post: 08-07-2011, 08:32 PM -
C server code - Java CLient Code _ TCP Connection Problem
By rmd22 in forum NetworkingReplies: 0Last Post: 02-21-2011, 11:50 AM -
can any one pls send me a sample code for calling a jsp code in swings
By sniffer139 in forum AWT / SwingReplies: 1Last Post: 03-04-2010, 11:19 AM -
Generating Code Automatically Using Custom code Template In Eclipse
By JavaForums in forum EclipseReplies: 1Last Post: 04-26-2007, 03:52 PM


2Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks