Wednesday, 19 November 2014

Core Java Basic Quetions

1. What is the base class of all classes?
java.lang.Object
2. Does Java support multiple inheritance?
Java doesn't support multiple inheritance.
3. Is Java a pure object oriented language?
Java uses primitive data types and hence is not a pure object oriented language.
4. Are arrays primitive data types?
In Java, Arrays are objects.
5. What is difference between Path and Classpath?
Path and Classpath are operating system level environment variales. Path is used define where the system can find the executables(.exe) files and classpath is used to specify the location .class files.


6. What are local variables?
Local varaiables are those which are declared within a block of code like methods. Local variables should be initialised before accessing them.


7. Which class is extended by all other classes?
The Object class is extended by all other classes.
8. Which non-Unicode letter characters may be used as the first character of an identifier?
The non-Unicode letter characters $ and _ may appear as the first character of an identifier
9. What restrictions are placed on method overloading?
Two methods may not have the same name and argument list but different return types.
10. What is casting?
There are two types of casting, casting between primitive numeric types and casting between object references. Casting between numeric types is used to convert larger values, such as double values, to smaller values, such as byte values. Casting between object references is used to refer to an object by a compatible class, interface, or array type reference.
11. What is the return type of a program's main() method?
void.

12. If a variable is declared as private, where may the variable be accessed?
A private variable may only be accessed within the class in which it is declared.

No comments:

Post a Comment