Classes | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Classes

how is it possible to make 2nd class in this program.

5th Sep 2017, 5:52 PM
Ilias
Ilias - avatar
10 Answers
+ 9
maybe doesn t support project but only main program. I read somethings about inner class but i don t know if it could be good for what you want to do
5th Sep 2017, 10:56 PM
Davide Mazzeo
Davide Mazzeo - avatar
+ 5
Yes, in Java you can have multiple classes in one file. Only one class can be public and its name should match the filename. The rest of the classes can be package default, or protected or private nested classes. Only one class should have a main method.
5th Sep 2017, 6:07 PM
ChaoticDawg
ChaoticDawg - avatar
+ 5
+The class matching the filename is called constructor and is used for creating objects
5th Sep 2017, 6:11 PM
Lucien
Lucien - avatar
+ 3
what class, what program?
5th Sep 2017, 5:53 PM
Lucien
Lucien - avatar
+ 3
you mean having two classes in one java project?
5th Sep 2017, 6:00 PM
Lucien
Lucien - avatar
+ 3
class A { // class A code } class B { // class B code }
5th Sep 2017, 6:01 PM
ChaoticDawg
ChaoticDawg - avatar
+ 1
I have basic knowledge of java. I need to make second class in this app..I try to write code in solearn
5th Sep 2017, 10:08 PM
Ilias
Ilias - avatar
- 1
I'm coding in sololearn and I can't create second class, what to do?
5th Sep 2017, 5:59 PM
Ilias
Ilias - avatar
- 1
2 classes in one file?
5th Sep 2017, 6:03 PM
Ilias
Ilias - avatar
- 2
it is impossible to import JFrame? right?
5th Sep 2017, 11:50 PM
Ilias
Ilias - avatar