Some questions for you from java.lang package

1. How many ways you can copy one object properties to another?
Ans: 3 ways – Shallow copying, Deep copying and Cloning.
2. How many types of inner classes exist?
Ans: 4 types.
3. What are JAR files?
Ans: JAR file is a zipped file zipped by JVM.
4. How to convert a string into data type?
Ans: String to data type conversions – byte, short, int, long, float, double, char and boolean.
5. How to convert an object to string?
Ans: Object to String – toString()
6. Do you know the functionality and methods of following java.lang package classes?
Ans: 1. Root class – class Object 2. class Character 3. class System
7. What are wrapper classes?
Ans: Wrapper classes
8. What is the garbage collection mechanism in Java?
Ans: Garbage Collection – gc() and exit(0)
9. How to use the C++ destructor functionality where Java does not support destructors?
Ans: Java Destructor – finalize()
10. How to compare two objects?
Ans: Object comparison – hashCode() & equals()

Leave a Comment

Your email address will not be published.