Class :

public class test2 {

    public static String fetchHTML(){
        return '';

    public class happyDays{
        public void happyDaysMethod(){



Now if I have to refer happyDays class from some other class I will have to refer it like this:

public class Test1{

   public test2.happyDays objTest4321 {get; set;}

as public happyDays objTest4321 {get; set;} will give compilation error.

Does this mean defining inner class may increase apex character count as we are using ParentClassReference.InnerClass, so ParentClassReference name character count increases?

1 Answer 1


Yes but inner classes can have benefits that far, far outweigh the normally insignificant factor of the Apex character count.

See e.g. Purpose of an inner class.

  • yes I do understand the purpose of it, was just curious to check if Apex character count is included or not. Thanks Dec 22, 2020 at 16:07
  • 2
    @NagendraSingh One really easy way to drastically reduce character count is to replace any instances of four spaces (or whatever you prefer to use for indentation) with actual tabs. In a typical project, I've seen as much as a 25% reduction in Apex character count. The increased limit (6MB) means you'll rarely need this, but if you want a quick way to drop the count, this is definitely low-hanging fruit you can reach for.
    – sfdcfox
    Dec 23, 2020 at 0:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .