I'm somewhat new to Java and I was wondering if there was a way to change the function of a class somehow.
Class pager = new Pager();// everything is initialized
pager.dostuff() = function(){};
Is there a specific name for this and is it possible to do in Java? If not, is there a language that does allow it?
Thank you for your time.
Edit:
To clarify the question because originally it seemed like I wanted to initialize the new class with different functions. That is not the case. I want to change it after it's already been created. The reason for this is that I'm working with android and the class I'm getting is from the xml. Is it possible to change the class' function when I get the class like so?
Pager pager = (ViewPager) findViewById(R.id.pager)
I feel like I'm going to have to create a new class, which is ok but I wanted to see if I could do it this way.