Connect with Facebook Lost Password?


Go Back   CodeCall Programming Forum > Software Development > Java Help

Java Help Java Help forum discussing all Java platforms - J2ME, J2SE and J2EE - as well as relevant standards, APIs and frameworks such as Swing, Servlets, JSPs, Applets, Struts, Spring, Hibernate, ANT, EJB, and other Java-related topics.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-09-2008, 04:53 AM
Newbie
 
Join Date: Aug 2007
Posts: 17
Rep Power: 0
debug is an unknown quantity at this point
Default need some help

Quote:
import java.util.*;
public class puzzle{
final static int MAX_ROW = 8;
final static int MAX_COL = 4;
static int numRow;
static int grid[][] = new int[MAX_ROW][MAX_COL];
public static void main(String[] args){
System.out.println(" Enter the number of row:");
Scanner myScanner = new Scanner(System.in);
numRow = myScanner.nextInt();
for(int i = 0; i < numRow; i++)
{
for (int j = 0; j < MAX_COL; j++)
{
System.out.print(grid[i][j]);
}
System.out.println();
}
}
}
m writing a code to display the tic-tae-toe board but when i run the code the display show only 0 . Can someone help me which part of my code went wrong?? thkx in advance.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-12-2008, 04:38 PM
gszauer's Avatar   
Programmer
 
Join Date: Nov 2007
Location: Florida
Age: 19
Posts: 113
Rep Power: 6
gszauer is on a distinguished road
Default Re: need some help

You have nothing to turnicate one row, and start the second.
Do this
import java.util.*;

Code:
public class puzzle{
  final static int MAX_ROW = 8;
  final static int MAX_COL = 4;
  static int numRow;
  static int grid[][] = new int[MAX_ROW][MAX_COL];
  public static void main(String[] args){
    System.out.println(" Enter the number of row:");
    Scanner myScanner = new Scanner(System.in);
    numRow = myScanner.nextInt();
    for(int i = 0; i < numRow; i++)    {
      for (int j = 0; j < MAX_COL; j++)    {
        System.out.print(grid[i][j]);
      }
      System.out.print("\n");
    }
    System.out.println();
  }
}
__________________
Quote:
Originally Posted by ~Aristotle
It is the mark of an educated mind to entertain a tought without accepting it
If my post was helpful, please help me build some rep
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 02:50 PM.

Freelance Jobs

XML/XSL: Need code for Book with Chapers using XML
Create an XML file for a book of your creation, and a basic CSS file that will format it to display ...
Earn: $40.00


C++/C: Simple firework cue sequencer
What I require is a rework of a simple cue sequencer. I have a piece of hardware (an Arduino boar...
Earn: $50.00


HTML/XHTML: Menu Rework - ASCIIBin
I'm placing this in the HTML/XHTML section of the Freelance site but you are not limited to HTML. Wh...
Earn: $20.00



CodeCall Goal

Goal #1: 1,000 Blogs
Goal #2: 1,000 Wiki Pages
Goal #3: 300,000 Posts
Goal #4: 20,000 Threads
Done: 30%, 23%, 55%, 75%

Ads