Why is required to define a new class when I create a new Java module in Android Studio?

169 Views Asked by At

When we create a new java lib module in Android Studio, it's mandatory to provide a name for the java class. I never know what to give, since it's not common to have a central class in a library. What is the purpose of this class?

enter image description here

1

There are 1 best solutions below

1
On BEST ANSWER

When you are creating a java module, you are basically creating a java file - which will (obviously) contain java code.

The minimal structure of a java code (ClassA.java file as example) is like this:

// your imports

public class ClassA{

    // variables and methods inside ClassA

} // end of ClassA

The code (ClassA.java file) might contain additional classes - but it must contain at least one public class.

In the dialog box shown in your question, you are asked to provide the name of the public class which will be in the java module.