Core Java Interview Questions - Part 2


		a.	for(int i = 100000; i > 0; i--)
			{
			}
		b.	for(int i = 1; i < 100001; i++)
			{
			}
		(a)	for(int i = 100000; i > 0; i--)
			{
			}
						

		a.	static void changePoint ( Point p) 
	           {
		p.x = 100; p.y=200;
               }
              b.	static void changePoint(Point p) {
          p=new Point(100,200);
               }
a. (100,200) b. (700,800) [Note: Primitive type is passed by value in method parameter and objects are passed by value of the reference. In a method if the object values are changed , it will reflect, but if we try to change the reference itself its original reference/object will not change, as only copy of the reference is changed.]
						  
(c) char (All numeric data types are signed. 'char' is the only unsigned integer type.)
No, inner class cannot have static members.
Yes.[Constructor can throw exception.]
Overriding methods cannot throw more generic exceptions than base method.
Yes, finalize method can be overloaded but only the below given version is called by garbage collector: protected void finalize() throws Throwable { };
False. [Nested class can extend any class or implement any interface.]
Yes, we can declare derived class first and then base class in Java.
False. [GC is a low priority thread.]
Dictionary is a class and not an interface.
Member variables are resolved at compile time.
Map does not implement collection.
False [ Random access file descends from object and implements data input and data output.]
No, interface cannot be declared final as they are implicitly abstract.
All methods in an interface are implicitly public, abstract but never static.
False [Java does not support multi-dimensional arrays. It only supports nested arrays.]