function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

If main class is private and inner class is public, can the inner class be accessible and vice-versa. I got this question in interview

Best Answer chosen by Rahul
Santosh Reddy MaddhuriSantosh Reddy Maddhuri
HI Sumit,

Main class must always be Public or global.

Private is the default access modifier Only for Inner classes

default class would be somethins like this
public/Global class MainClass{

  //do something.

 private Class InnerClass {
   //do something more.



you can find detail info here

Hope this helps!