I have Created a Tic tac toe game a also made a player record GUI where it takes the 2 players data

II have Created a Tic tac toe game a also made a player record GUI where it takes the 2 players data means there names and also connected those data with my SOL but whenever a player wins or the game ends no data was inserting into my sql schema .. I have checked everything but fail to find out the error .. so if anyone knows about it so please help me >>>> Here is the code https://sourceb.in/tGtZQbJWs9
10 Replies
JavaBot
JavaBot13mo ago
This post has been reserved for your question.
Hey @Danix! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here. 💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
imp_o_rt
imp_o_rt13mo ago
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot invoke "TicTacToe.main.playersRecord(String)" because "this.main" is null
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot invoke "TicTacToe.main.playersRecord(String)" because "this.main" is null
main is never initialised inside TicTacToe or never passed what i would recommend is breaking out the sql stuff into a new third class called e.g. PlayerTracking that is only responsible for the database stuff, and instantiating that in TicTacToe also you are comparing strings with == which is not right; you should use .equals for comparing strings in java
JavaBot
JavaBot13mo ago
Looks like you're having some trouble comparing strings, check out this stackoverflow question for help.
imp_o_rt
imp_o_rt13mo ago
if you are having the sql stuff inside main because that's where the player names are, you can pass those into TicTacToe's constructor so they are available there and you can do the sql stuff inside there (or pass them further into the breakout new third class i suggested)
imp_o_rt
imp_o_rt13mo ago
Stack Overflow
Java: how to pass arguments into constructor? Undefined method error?
Ok, so I'm in need of some basic help. Here's the tutorial I'm trying to learn from (http://docs.oracle.com/javase/tutorial/java/javaOO/classes.html), but I'm confused as to how to actually pass data
JavaBot
JavaBot13mo ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
Danix
DanixOP13mo ago
Ok everything is fine now but I still have one issue I want to track the winner and also insert the winner history of every game in my database but am not getting any logic to build it .. if u have any idea so please help me
Unknown User
Unknown User13mo ago
Message Not Public
Sign In & Join Server To View
Danix
DanixOP13mo ago
Hmm I will try to do it
JavaBot
JavaBot13mo ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.

Did you find this page helpful?