-
-
-
String b=new String("A");
String c="A";
String d="A";
Then which of the following returns true?
1. if(a==b)
2. if(b==c)
3. if(c==d)
4. if(d==a)">String a=new String("A");String b=new String("A");String c="A";String d="A";Then which of the following returns true?1. if(a==b)2. if(b==c)3. if(c==d)4. if(d==a)
-
-
-
-
-
We know that when execution of java starts, 1 st public static void main(String args[]) methodis execute. so i have ask you that ,when main method is executed, it s static method. so at the time of execution of main method, object is not their. after that code under main method is run which contain object of classes.so Q. when main method is executed,at that time object is not in memory so at that time can i say that JAVA IS NOT OBJECT-ORIENTED???
ACCORDING TO ME yes,after main methode,code run which will create object after main method, java is OBJECT ORIENTED.
-
-
Primitive Types
What happens when you add a primitive type (e.g. double) value to a collection?
-
How are Observer and Observable used
Objects that subclass the Observable class maintain a list of observers. When anObservable object is updated it invokes the update() method of each of its observers tonotify the observers that it has changed state. The Observer interface is implemented byobjects that observe Observable objects.
-
Does garbage collection guarantee that a program will not run out of memory
Garbage collection does not guarantee that a program will not run out of memory. It ispossible for programs to use up memory resources faster than they are garbage collected.It is also possible for programs to create objects that are not subject to garbage collection
-
If a variable is declared as private, where may the variable be accessed
A private variable may only be accessed within the class in which it is declared.
-
How does multithreading take place on a computer with a single CPU
The operating system's task scheduler allocates execution time to multiple tasks. Byquickly switching between executing tasks, it creates the impression that tasks executesequentially.
-
Which package is always imported by default
The java.lang package is always imported by default.
-
What is the purpose of garbage collection
The purpose of garbage collection is to identify and discard objects that are no longerneeded by a program so that their resources may be reclaimed and reused.
-
What modifiers may be used with a top-level class
A top-level class may be public, abstract, or final.
-
-
-
Java Interview Questions
Ans