How does access modifiers work?
Public: It is the highest visibility access modifier. It makes visible the class members (variables/methods) to any classes (child/non-child) present within same or any package.
Protected: It has lesser visibility than public access modifier. It makes visible the class members (variables/methods) to sub-classes within same or different package and it also make visible in any class of same package.
Default: It has lesser visibility than protected access modifier. It makes visible the class members (variables/methods) to any classes within same package only.
Private: It has least visibility than all access modifiers. It makes visible the class members (variables/methods) within same class only.
Is This Answer Correct ? | 4 Yes | 0 No |
I want to run a simple hello world java (HelloWorld.java) program using a batch file. How can i run it and how to construct a batch file.
What is default exception handling in java?
State some situations where exceptions may arise in java?
What is the current version of java?
Explain constructors and types of constructors in java.
what is translator and it types
Write a program in java to establish a connection between client and server?
What is the final method?
what is difference between type 4 driver and type 1 driver?
2 Answers CMC, CTS, IBM, JK Technosoft, Napier Healthcare,
There are two classes named classa and classb. Both classes are in the same package. Can a private member of classa can be accessed by an object of classb?
class A{ m2(){ } } class B extends A{ m2(){ } } class c extends B{ m2(){ } } class my_class extends c{ m2(){ } pulic static void main(){ ...My_class a = new my_class(); super.super.super.m2(); is this is leagal if not find what is the legal procedure in order to call A's version of m2(); }
What do you understand by overloading and overriding in java?