Default constructors in Java

前端 未结 7 1717
南旧
南旧 2020-12-09 07:21

I know I\'m asking some serious 101 question here...

I have some class Foo and a class Bar that extends Foo. In Foo

7条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-09 07:58

    This error could also happen because you are calling your super constructor last. You might have to move it to be the first statement:

        public SectionsPagerAdapter(FragmentManager manager, List fragmentList) {
            mFragmentList  = fragmentList;
            super(manager);
    
        }
    
        public SectionsPagerAdapter(FragmentManager manager, List fragmentList) {
            super(manager); --> this should come first
            mFragmentList  = fragmentList;
        }
    

提交回复
热议问题