Re: first quick java program

  • From: "Littlefield, Tyler" <tyler@xxxxxxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Tue, 22 Mar 2011 12:01:01 -0600

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);
}

}



--

Thanks,
Ty

__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: