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

Deleted user
by Deleted user

more than one

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 , Java Chief Architect , Crossover

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