* Main.java
*
* Created on 22 August 2006, 21:56
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package javaapplication7;
/**
*
* @author Dan
*/
public class Main {
 
/** Creates a new instance of Main */
public Main() {
class Token
{
public static final int o = 1;
public static final int x = 2;
/** INV: token should be a member of the set:
* { Token.o, Token.x }
*/
private int token = 0;
public int getToken() ;
{return token;
}
public void setToken(String token1) {
token = token1;
} 
public String toString()
{
if (token == 1)
return "o";
else if (token == 2)
return "x";
else
return " ";
}
 
 
public class board {
String[]boardList = newstring[8];
{for (string i=0; i<=1;i++){
System.out.println(boardList[i]); 
}
}
} 
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
 
}
 
}
}
}
{
}

I HAVE PUT THIS CODE INTO NETBEANS. I CANT RUN THE PROGRAM BECAUSE I GET ERRORS. COULD SOMEONE PLEASE HELP POINT OUT WHY I GET THESE ERRORS AND WHAT COULD BE DONE TO SOLVE THEM. MUCH APPRECIATED

Dan

Recommended Answers

All 3 Replies

HEY DAN!

IT MIGHT BE BEST TO USE THE CODE Tags!!!!1

IT ALSO MIGHT BE BEST IF YOU LET US KNOW WHAT YOUR ERRORS Are Too!

What do u mean by CODE tags. The error i am gettin is when i try to run the program. It says, "No classes found". And the 2nd from bottom bracket is underlined red and says class or interface expected.

Thanks

So my guess is you didn't read the very first post in this forum titled: Please use BB Code and Inlinecode tags. It helps us other people that don't have much time to hopefully allow us to scan your code and see anything that looks fishy. Some people might even call it being polite.

Anyways... on to your problem. I've highlighed problems with bold. And there is an ass bag of problems.

[b]/*[/b]
* Main.java
*
* Created on 22 August 2006, 21:56
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package javaapplication7;
/**
*
* @author Dan
*/
public class Main 
{
  /** Creates a new instance of Main */
  public Main() 
  {
    class Token
    {
      public static final int o = 1;
      public static final int x = 2;
      /** INV: token should be a member of the set:
         * { Token.o, Token.x }
         */
       private int token = 0;

       public int getToken() [b]; // remove this ;[/b]
       {
          return token;
       }

       public void setToken(String token1) 
       {
          token = [b]token1; // token1 is a string and its being cast to an int.  So you will have to decide if you want a String or an int.[/b]
       }

       public String toString()
       {
         if (token == 1)
      [b]{ // this is only code style and not an actual compile error.  Its LAZY to not put the bracket here.[/b]
           return "o";
         }
         else if (token == 2)
         {
           return "x";
         }
         else
         {
           return " ";
          }
       }

[b]I'm pretty sure you need to finish the Token class before placing another class here.  You might even consider breaking all these classes up into different .java files.[/b]

public class board {
String[]boardList = newstring[8];
{for (string i=0; i<=1;i++){
System.out.println(boardList[i]);
}
}
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here

}

}
}
}
{
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.