answersLogoWhite

0

The final modifier has nothing to do with access. If your "outer" classes can see the method, they can access them just like any other methods.

User Avatar

Wiki User

15y ago

What else can I help you with?

Continue Learning about Engineering

What are the usages of keyword final in java?

It's a built-in keyword that defines an entity that cannot be later modified. It can be used in different aspects within your code (like setting a 'final' class, method (function), or variable).


What is a specifier?

a specifier tells the JVM how to treat a particular class,method and variable while executing the program. For example, final classes cannot be extended and final methods cannot be overriden and final variables cannot be changed once declared. Likewise,static methods and variables can be accessed without having to instantiate an object for their class


What are sealed classes in java?

Final classes are sealed classes in java I guess.


What can be declared in an abstract class?

Abstract classes are to be extended until to a concrete class.Can have both abstract & non abstract methods.An Abstract class can not be instantiated.A non abstract class can be extended to an abstract class.If At least one abstract method present in a class then that class must be abstract.abstract & final modifiers can never be together.abstract classes can have both abstract methods & non abstract methods.


Why method inner classes can only access final variables from method?

I think the main reason is because the inner class may "outlive" the method in which it was created. If this happens, then the memory storing those variables would be lost and we would run into problems when trying to access them. If the variables are defined as final, then Java knows that those values will never change and it can move/copy them when the class is created.

Related Questions

How do you prevent inheritance in java?

If a class is declared as final, you can't inherit from it. If individual methods are declared final, then, if the class is inherited, these methods can't be changed in the inherited classes.


What are the usages of keyword final in java?

It's a built-in keyword that defines an entity that cannot be later modified. It can be used in different aspects within your code (like setting a 'final' class, method (function), or variable).


What is a specifier?

a specifier tells the JVM how to treat a particular class,method and variable while executing the program. For example, final classes cannot be extended and final methods cannot be overriden and final variables cannot be changed once declared. Likewise,static methods and variables can be accessed without having to instantiate an object for their class


What are sealed classes in java?

Final classes are sealed classes in java I guess.


What can be declared in an abstract class?

Abstract classes are to be extended until to a concrete class.Can have both abstract & non abstract methods.An Abstract class can not be instantiated.A non abstract class can be extended to an abstract class.If At least one abstract method present in a class then that class must be abstract.abstract & final modifiers can never be together.abstract classes can have both abstract methods & non abstract methods.


What does the Dragon King do in Final Fantasy I?

Bahamut the Dragon King is an important character in Final Fantasy. He upgrades your party's classes if you have the Rat's Tail from the Citadel of Trials, strengthening your party and granting you access to more better equipment in the game.


Is it likely that the final abundance distribution among the age classes will be similar?

Is it likely that the final abundance distribution among the age classes will be similar


Why method inner classes can only access final variables from method?

I think the main reason is because the inner class may "outlive" the method in which it was created. If this happens, then the memory storing those variables would be lost and we would run into problems when trying to access them. If the variables are defined as final, then Java knows that those values will never change and it can move/copy them when the class is created.


What is difference in use between interfaces and abstract classes in java?

While neither abstract classes nor interfaces can be instantiated in Java, you can implement methods in abstract classes. Interfaces can only define methods; no code beyond a method header is allowed.


Discuss final method and final classes?

a method declared final can not be overridden, and a class declared as final can not be extended by its sub class.


Final classes in java?

A class declared as final means that no other class can inherit from it.


Can you take private methods and final methods as same?

Yes, a method which is declared as private is inaccessible to subclasses, and can thus be thought of as final, as well.