Explain the differences between public, private, protected
and static?
Answer Posted / ranganathkini
Members marked public are accessible to members of any class
irrespective of the package.
Members marked private are only accessible to other members
of the same class.
Members marked protected are only accessible to other
members of the same class, members of a subclass and members
of other classes in the same package.
Member marked static are shared by all instances of that
class and hence r not related to any specific instance of
that class. Methods marked static cannot access non-static
members or fields of that class. But non-static members can
access static fields or methods.
| Is This Answer Correct ? | 111 Yes | 21 No |
Post New Answer View All Answers
What is the difference between jvm and jre? What is an interface?
What is the use of conditional statement?
Explain about interthread communication and how it takes place in java?
What is the integer of 16?
Is it possible to override private or static method in java?
What is a private class in java?
What is t type java?
What is an interoperable application in java ?
Is there any way to find whether software installed in the
system is registered by just providing the .exe file?
I have tried the following code but its just displaying the
directory structure in the registry.
Here the code :
package com.msi.intaller;
import java.util.Iterator;
import ca.beq.util.win32.registry.RegistryKey;
import ca.beq.util.win32.registry.RootKey;
public class RegistryFinder {
public static void main(String... args) throws Exception
{
RegistryKey.initialize(RegistryFinder.class.getResource("jRe
gistryKey.dll").getFile());
RegistryKey key = new RegistryKey(RootKey.HKLM,
"Software\\ODBC");
for (Iterator
Difference between start() and run() method of thread class?
What is the purpose of lambda expressions?
What are benefits of java?
How is treeset implemented in java?
Explain about sets?
What are runtime exceptions?