Basic Interview Question in java
1. what is path and classpath in java?
Path is an environment variable which is used by the operating system to find the executables.
Classpath is an environment variable which is used by the Java compiler to find the path,
of classes.ie in J2EE we give the path of jar files.
2. Can we have multiple public classes in a java source file?
We can’t have more than one public class in a single java source file. A single source file can
have multiple classes that are not public.
3. What is Enum in Java?
Enum was introduced in Java 1.5 as a new type whose fields consists of fixed set of constants.
For example, in Java we can create Direction as enum with fixed fields as EAST, WEST, NORTH, SOUTH.
enum is the keyword to create an enum type and similar to class. Enum constants are implicitly static and final.
4.What is Classloader in Java?
Java Classloader is the program that loads byte code program into memory when we want to access any class. We can create our own classloader
by extending ClassLoader class and overriding loadClass(String name) method.
5. Why java is not 100% Object-oriented?
Java is not 100% Object-oriented because it makes use of eight primitive datatypes such as boolean, byte, char, int, float, double, long, short which are not objects.
1. what is path and classpath in java?
Path is an environment variable which is used by the operating system to find the executables.
Classpath is an environment variable which is used by the Java compiler to find the path,
of classes.ie in J2EE we give the path of jar files.
2. Can we have multiple public classes in a java source file?
We can’t have more than one public class in a single java source file. A single source file can
have multiple classes that are not public.
3. What is Enum in Java?
Enum was introduced in Java 1.5 as a new type whose fields consists of fixed set of constants.
For example, in Java we can create Direction as enum with fixed fields as EAST, WEST, NORTH, SOUTH.
enum is the keyword to create an enum type and similar to class. Enum constants are implicitly static and final.
4.What is Classloader in Java?
Java Classloader is the program that loads byte code program into memory when we want to access any class. We can create our own classloader
by extending ClassLoader class and overriding loadClass(String name) method.
5. Why java is not 100% Object-oriented?
Java is not 100% Object-oriented because it makes use of eight primitive datatypes such as boolean, byte, char, int, float, double, long, short which are not objects.
No comments:
Post a Comment