Help with Java Project (Android Studio)

Hey. I’m new to the forums so I’m learning as I go. I just finished my Codecademy Java course and I want to practice until more lessons are added. I want to create a tic-tac-toe game using Android Studio, but I’m having problems on when should I create new packages and classes. If anyone can help me, I would greatly appreciate it.

1 Like

Hi Mike,

A class is a declaration (and often implementation) which encapsulates the members properties and methods which instances of that type will posses. You can create instances of a class as distinct, individual objects that behave as specified.

A package is simply a namespace under which you can categorize classes, analogous to a “folder” or “path”, so you can group classes with related purpose or functionality.

2 Likes

Should my projects include multiple packages then?

You can store classes that are doing related things in one package. Like if you have a class that’s displaying the board and one that’s updating it, they should be in the same package.

2 Likes

So for my game, I need to have a class for the board, one for updating, one for the Xs, and one for the circles. Right?

3 Likes

Yes, that’s totally fine if they’re in the same package / file

2 Likes