React.js
Angular
Ethical Hacking
Agile
AWS
BlockChain
Cassandra
Cloud
Salesforce
Scaled Agile
TOGAF
DevOps
GIT
Jenkins
Jira
Kibana
Linux
NGINX
Ansible
Artificial Intelligence
in JAVA by
Can we have multiple classes in single file ?

Yes we can have multiple classes in single file but it people rarely do that and not recommended. We can

have multiple classes in File but only one class can be made public. If we try to make two classes in File

public we get following compilation error.

“The public type must be defined in its own file”.
Click here to read more about JAVA

1 Answer

0 votes
by

Yes we can have multiple classes in single file but it people rarely do that and not recommended. We can

have multiple classes in File but only one class can be made public. If we try to make two classes in File

public we get following compilation error.

“The public type must be defined in its own file”.

Related questions

Madanswer
0 votes
asked Jun 17, 2019 in JAVA by reins.robin
0 votes
asked Jun 17, 2019 in JAVA by reins.robin
...