Basic Java Interview Questions and Answers - 4
19. Can a class have multiple constructors?
Yes, a class can have multiple constructors with different parameters. You can define as many constructors as you need. When a Java class contains multiple constructors, we say that the constructor is overloaded.20. Is String a data type in java?
String is not a primitive data type in java. It's a class, a reference type. It is an object of Java.Lang.String class.21. What is multi-threading?
Multi threading is running multiple tasks in a concurrent manner within a single program. Multi-threading is a special form of multitasking. Multi-threading allows you to write very efficient program that makes maximum use of CPU because idle time is kept to minimum.22. Can we use Pointers in Java class?
We can't use concept of pointers in Java.23. Can a class in Java be inherited from more than one class?
In Java, a class can be derived from only one class and not from multiple classes. Multiple inheritance is not supported by Java.24. What is Garbage collector?
Garbage collector is the process of automatically freeing objects that are no longer referenced by the program. It reduces a programmer's work from having to track when to free allocated memory. Java provides memory management through garbage collector.