简体   繁体   中英

Cannot Find Symbol error when using .isVisible method

The following code gives me an error: cannot find symbol

public static boolean playerTurn = true;
public static boolean playerWon = false;
public static boolean player2Won = false;

public static TicTacToe board = new TicTacToe();

public static void main (String args []) {
    if (board.isVisible() == false){
        board.setVisible(true);
    }
}

This is the first part of code of the other class:

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.GroupLayout;
import javax.swing.LayoutStyle;
public class TicTacToe extends JFrame {
    public TicTacToe() {
            initComponents();
    }

Why am I getting this error? How can I fix it?

You're missing the parentheses from the method call. It's isVisible() not isVisible .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM