Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Can we keep more than one class in java file?

user-image
Question added by gagandeep kaur gagan , internship , hcl-cdc
Date Posted: 2013/06/25
gagandeep kaur gagan
by gagandeep kaur gagan , internship , hcl-cdc

yes we can more than class in java file but only one class can be declare public

Ahmed Kamal
by Ahmed Kamal , web developer , EMRK Company

more than one

mohammad AbuElmagd
by mohammad AbuElmagd , Coordinator , Suez Canal Container Terminal (SCCT)

yes you can but no more one public class

RISHI PANIKKAVEETIL PALLATH
by RISHI PANIKKAVEETIL PALLATH , Software Engineer , Etisalat

<p>Yeah ofcourse, but only on one condition : any one of that class inside the java file must be of public and have same name as of that java file.</p>

Shivdhwaj Pandey
by Shivdhwaj Pandey , software engineering manager , the parentinc

<p>Yes but have command over how to use them.</p>

Bassem Zohdy
by Bassem Zohdy , Senior Software Architect , HelpAG

yes you can but only one of them public and its name is as same as the java file

<p>Yes ofcourse.We can do this through inner class concept.The different types inner class are static inner class,nonstatic inner class,local inner class,annonymous inner class.</p>

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.