Awesome, makes sense; thanks. I think what I'll do is just declare a board class and then I can put methods pertaining to the board on that object, as well as a function to get what's at a specific element.
On 3/22/2011 12:11 PM, Jared Wright wrote:
It's a convention, but a pretty widely accepted one. And you need to declare a TTT object and call its printBoard method if you don't want it to be static.On 3/22/2011 2:01 PM, Littlefield, Tyler wrote:Hello: I've always used cammel case for my method capitalization. why do you not capitalize methods? Is this something pertaining to Java? Or is it just a naming convention thing. Thanks, On 3/22/2011 11:59 AM, Stanzel, Susan - Kansas City, MO wrote:I have not studied the entire logic, but PrintBoard is a method and you don't cap the first word of a method. I don't think it would have to be static, but I am also a Java beginner. You might consider writing on the Java programming list. Susie Stanzel -----Original Message----- From: programmingblind-bounce@xxxxxxxxxxxxx [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Littlefield, Tyler Sent: Tuesday, March 22, 2011 12:55 PM To: programmingblind@xxxxxxxxxxxxx Subject: first quick java program Hello all: I am writing a quick tic-tac-toe game, and so far I have Java printing out the board. I'm curious if 1) this is the right way to go about it, and 2), i'm noticing that I have to declare PrintBoard as static. Is there a way around that? Thanks, public class ttt { public static void PrintBoard(String[] board) { int i, j; System.out.println("|-|-|-|"); for (i= 0; i< 3; i++) { for (j = 0; j< 3; j++) { System.out.print(board[i*j]+"|"); } System.out.println("|-|-|-|"); } } public static void main(String[] args) { int i; String[] board = new String[9]; for (i = 0; i< 8; i++) { board[i] = " "; } PrintBoard(board); } }__________View the list's information and change your settings at //www.freelists.org/list/programmingblind
-- Thanks, Ty __________View the list's information and change your settings at //www.freelists.org/list/programmingblind