Posts

Showing posts with the label important question answer in java

Java interview question answer

1. What is java? Java is a OOP based computer programming language.  2. Explain, what is the difference between private, protected, and public in java? These java keywords are for following privileges to component such as variables and methods. Public: All classes can be access Private: Can be access only the class to which belongs Protected: Can be access to the class to which they belongs and any subclasses. 3. What are access specifiers in java? Access specifiers are keywords that determine the type of access to the member of a class.  There are four types of specifiers in java (a) Public, (b) Private, (c) Protected, and (d) Defaults. 4. What's the difference between normal methods and constructors? Constructors cannot return a value and must have the same name as the class. Constructors are only called once while normal methods could be called many times and it can return a value or can be void (it is your choice).  5. It is possible to call on