Documente Academic
Documente Profesional
Documente Cultură
} %>
Session will accept Object and values. Where as Cookie accept only values.
When you say getSession(false), this method will check whether a session is
existing. If yes, then it returns the reference of that session object, OTHERWISE
IT WILL RETURN 'null'.
******************************************************************************
6) Reflections?
try {
Class c = Class.forName("java.awt.Dimensions");
Method methods[] = c.getMethods();
Filed fields[] = c.getFields();
Constructor constructors[] = c.getConstructors();
} catch (Exception e) {
System.out.println(e);
}
1
7) Shallow Copy: Clone method() is called Shallow Copy.
This means value of all the orginal Object fields are copied to the fields
of new object
or commonly
Yes, a lock can be acquired on a class. This lock is acquired on the class's
Class object.
14) What is the difference between the >> and >>> operators?
15) What state does a thread enter when it terminates its processing?
16) What happens to a static var that is defined within a method of a class ?
Example:
String s7;
String S6 = new String();
System.out.print("S7 "+s7); //Variable s7 "might not have been
intialized"
System.out.println("S6 "+S6); //default empty
The program compiles properly but at runtime it will give "Main method not
public." message.
20) What if the static modifier is removed from the signature of the main method?
21) What if I write static public void instead of public static void?
2
Program compiles and runs properly.
22) How can one prove that the array is not null but empty using one line of code?
Yes it is possible. While starting the application we mention the class name
to be run. The JVM will look for the Main method only in the class whose name you
have mentioned. Hence there is not conflict amongst the multiple classes having
main method.
Checked Exception: User is aware of the excetion and he is able to catch it.
25) Are the imports checked for validity at compile time? e.g. will the code
containing an import such as java.lang.ABCD compile
26) Does importing a package imports the subpackages as well? e.g. Does importing
com.MyTest.* also import com.MyTest.UnitTests.*
No. A top level class can not be private or protected. It can have either
"public" or no modifier. if a top level class is declared as private the compiler
will complain that the "modifier private is not allowed here"
29) If I write System.exit (0); at the end of the try block, will the finally block
still execute?
No in this case the finally block will not execute because when you say
System.exit (0); the control immediately goes out of the program, and thus finally
never executes.
30) What is daemon thread and which method is used to create the daemon thread?
Daemon thread is a low priority thread which runs intermittently in the back
ground doing the garbage collection operation for the java runtime system.
setDaemon method is used to create a daemon thread.
***********************************************************************************
3
Functions does not return images where as Proceudres yes.
Functions take only “IN” as parameter and where as Procedures takes “IN”and
“OUT” parameter.
2) Trigger:
Database Triggers are stored procedures that is fixed when insert, update,
delete statemets are issued against the associated table.
Types of tiggers: Before, After, for each row, for each statement.
***********************************************************************************