1)In what ways does C++ and JAVA differ?
Java has no pointers.
Java supports garbage collection.
Java doent have destructor.
Java doen't provide the concept of operator overloading.
Java doesnt provides Multiple inheritance, but it can be available through interfaces.
Java is platform Independent.
Java supports multithreading, whereas C++ dont provide it.
2)Is JAVA 100% OOPs?
Java supports primitive types like int, char, float ,double , and then rest of the types are objects.
Hence some people are saying it is not a pure oo Programming language.
Java supports primitive types like int, char, float ,double , and then rest of the types are objects.
Hence some people are saying it is not a pure oo Programming language.
3)Explain the terms object, instance, reference and class?
Object: An Object can be termed as an instance of a class.
Instance: An instance is the values of data members of a class at particular point of time.
Reference: A reference is like a pointer to an object.
Class: A class is a data type(user-defined) with set of data members and its associated member functions.
Object: An Object can be termed as an instance of a class.
Instance: An instance is the values of data members of a class at particular point of time.
Reference: A reference is like a pointer to an object.
Class: A class is a data type(user-defined) with set of data members and its associated member functions.
4)What are the ways of creating an object?
Object can be created using four different ways like,
Using 'new' operator.
Using the syntax class.forName obj-name = Class.forName(fully qualified Class Name).newInstance().
Calling clone method of object class Eg: object.clone.
Using newInstance.
Object can be created using four different ways like,
Using 'new' operator.
Using the syntax class.forName obj-name = Class.forName(fully qualified Class Name).newInstance().
Calling clone method of object class Eg: object.clone.
Using newInstance.
5)Is there any immutable classes availble in Java? If so then tell some of them?
All the Wrapper classes in java.lang are immutable - String, Boolean,Integer, Long ,Short, Float,Byte,BigInteger.
6)What is Collections API in java?
Collection API is a set of interfaces and classes that supports or helps in manipulation of group of objects.The collection API is more advantageous than arrays and vectors.
EG:HashMap,TreeSet,TreeList.
Collection API is a set of interfaces and classes that supports or helps in manipulation of group of objects.The collection API is more advantageous than arrays and vectors.
EG:HashMap,TreeSet,TreeList.
7)What are the differences between HashMap and HashTable?
HashTable is synchronised whereas HashMap is unsynchronised.
HashTable doesnt allows null value as key, whereas HashMap allows null value as key.
Remember null is not a keyword in java.
HashTable is synchronised whereas HashMap is unsynchronised.
HashTable doesnt allows null value as key, whereas HashMap allows null value as key.
Remember null is not a keyword in java.
No comments:
Post a Comment