Contact Us || Privacy Policy || About Us |
|
1) Give the list of Java Object class methodsThe Java Object class methods are .
2) Can Java thread object invoke start method twice ?No, it throws IllegalThreadStateException 3) Can we override static method ?You cannot override static methods. Because Static methods are belongs to class, not belongs to object. 4) Can you list serialization methods ?Serialization interface does not have any methods. serialization is a marker interface. 5) What is the difference between super() and this() ?this and super are two special keywords in Java, (1) in Java , this represents current instance of a class, while super represent current instance of the parent class. (2) super() is used to call super class constructor, whereas this() used to call constructors in the same class, means to call parameterized constructors. 6) Can we create abstract classes without any abstract methods?Yes, we can create abstract classes without any abstract methods. 7) How to destroy the session in servlets?we can destory the session, By calling invalidate() method on session object. 8) Can we have static methods in interface?By default, all methods in an interface are decleared as public, abstract. It will never be static. Java 8 came with new feature called "default methods" with in interfaces. 9) What is transient variable?transient keyword is used in serialization. If you define any data member as transient, it will not be serialized. transient variable in Java is a variable whose value is not serialized during Serialization and which is initialized by its default value during de-serialization, for example for object transient variable it would be null. |