ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

Can we keep more than one class in java file?

user-image
تم إضافة السؤال من قبل gagandeep kaur gagan , internship , hcl-cdc
تاريخ النشر: 2013/06/25
gagandeep kaur gagan
من قبل gagandeep kaur gagan , internship , hcl-cdc

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

mohammad AbuElmagd
من قبل mohammad AbuElmagd , Coordinator , Suez Canal Container Terminal (SCCT)

yes you can but no more one public class

RISHI PANIKKAVEETIL PALLATH
من قبل 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
من قبل Shivdhwaj Pandey , software engineering manager , the parentinc

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

Bassem Zohdy
من قبل 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>

المزيد من الأسئلة المماثلة