<< < 13 14 15 16 17 18 19 20 21 22 23 > >>   Sort: Rank

Which containers use a border Layout as their default layout?
Which containers use a border Layout as their default layout? The window, Frame and Dialog classes use a border layout as their default layout.
2012-09-13, 3058👍, 0💬

What is a transient variable?
What is a transient variable? A transient variable is a variable that may not be serialized.
2012-09-13, 2183👍, 0💬

ArithmeticException?
ArithmeticException? The ArithmeticException is thrown when integer is divided by zero or taking the remainder of a number by zero. It is never thrown in floating-point operations.
2012-09-12, 2181👍, 0💬

Why do we need to use getSystemResource() and getSystemResources() method to load resources?
Why do we need to use getSystemResource() and getSystemResources() method to load resources? Because we want to look for resources strictly from the system classpath, These methods use the system ClassLoader to locate resources, which gives you stricter control of the resources used by the applicati...
2012-09-12, 2421👍, 0💬

The following statement prints true or false, why?
The following statement prints true or false, why? byte[] a = { 1, 2, 3 };, byte[] b = (byte[]) a.clone(); System.out.println(a == b); The false will be printed out. Because the two arrays have distinctive memory addresses. Starting in Java 1.2, we can use java.util.Arrays.equals(a, b) to compare wh...
2012-09-11, 2265👍, 0💬

What's the difference between the methods sleep() and wait()
What's the difference between the methods sleep() and wait() The code sleep(1000); puts thread aside for exactly one second. The code wait(1000), causes a wait of up to one second. A thread could stop waiting earlier if it receives the notify() or notifyAll() call. The method wait() is defined in th...
2012-09-11, 2216👍, 0💬

What is weak reference in Java
What is weak reference in Java A weak reference is one that does not prevent the referenced object from being garbage collected. You might use them to manage a HashMap to look up a cache of objects. A weak reference is a reference that does not keep the object it refers to alive. A weak reference is...
2012-09-10, 2203👍, 0💬

What is the differnce between final, finally and finalize?
What is the differnce between final, finally and finalize? final is used for making a class no-subclassable, and making a member variable as a constant which cannot be modified. finally is usuall used to release all the resources utilized inside the try block. All the resources present in the finali...
2012-09-10, 2259👍, 0💬

In which case would you choose a static inner class?
In which case would you choose a static inner class? Interesting one, static inner classes can access the outer class's protected and private fields. This is both a positive and a negitive point for us since we can, in essence, violate the encapsulation of the outer class by mucking up the outer cla...
2012-09-07, 2145👍, 0💬

What are the different types of inner classes?
What are the different types of inner classes? There are four different types of inner classes in Java. They are: a)Static member classes , a static member class has access to all static methods of the parent, or top-level, class b) Member classes, the member class is instance specific and has acces...
2012-09-07, 2201👍, 0💬

Can you call one constructor from another if a class has multiple constructors?
Can you call one constructor from another if a class has multiple constructors? Yes. Use this() syntax.
2012-09-06, 2632👍, 0💬

How to check two arrays to see if contents have the same types and contain the same elements?
How to check two arrays to see if contents have the same types and contain the same elements? One of options is to use the equals() method of Arrays class. Arrays.equals(a, b); If the array types are different, a compile-time error will happen.
2012-09-06, 2120👍, 0💬

When is the ArrayStoreException thrown?
When is the ArrayStoreException thrown? When copying elements between different arrays, if the source or destination arguments are not arrays or their types are not compatible, an ArrayStoreException will be thrown.
2012-09-05, 2160👍, 0💬

What is shallow copy or shallow clone in array cloning?
What is shallow copy or shallow clone in array cloning? Cloning an array invloves creating a new array of the same size and type and copying all the old elements into the new array. But such copy is called shallow copy or shallow clone because any changes to the object would be reflected in both arr...
2012-09-05, 2163👍, 0💬

Can we use System.arraycopy() method to copy the same array?
Can we use System.arraycopy() method to copy the same array? Yes, you can. The source and destination arrays can be the same if you want to copy a subset of the array to another area within that array.
2012-09-04, 2337👍, 0💬

How to make an array copy from System?
How to make an array copy from System? There is a method called arraycopy in the System class. You can do it: System.arraycopy(sourceArray, srcOffset, destinationArray, destOffset, numOfElements2Copy); When you use this method, the destinationArray will be filled with the elements of sourceArray at ...
2012-09-04, 2246👍, 0💬

What kind of security tools are available in J2SE 5.0?
What kind of security tools are available in J2SE 5.0? There are three tools that can be used to protect application working within the scope of security policies set at remote sites. keytool -- used to manage keystores and certificates. jarsigner -- used to generate and verify JAR signatures. polic...
2012-09-03, 2216👍, 0💬

What is the difference between final, finally and finalize?
What is the difference between final, finally and finalize? Short answer: final - declares constant finally - relates with exception handling finalize - helps in garbage collection If asked to give details, explain: final field, final method, final class try/finally, try/catch/finally protected void...
2012-09-03, 2288👍, 0💬

Why Java does not support multiple inheritance ?
Why Java does not support multiple inheritance ? This is a classic question. Yes or No depends on how you look at Java. If you focus on the syntax of "extends" and compare with C++, you may answer 'No' and give explanation to support you. Or you may answer 'Yes'. Recommend you to say 'Yes'. Java DOE...
2012-08-31, 2289👍, 0💬

Can a private method of a superclass be declared within a subclass?
Can a private method of a superclass be declared within a subclass? Sure. A private field or method or inner class belongs to its declared class and hides from its subclasses. There is no way for private stuff to have a runtime overloading or overriding (polymorphism) features.
2012-08-31, 2086👍, 0💬

How do you create a read-only collection?
How do you create a read-only collection? The Collections class has six methods to help out here: 1. unmodifiableCollection(Collect ionc) 2. unmodifiableList(List list) 3. unmodifiableMap(Map m) 4. unmodifiableSet(Set s) 5. unmodifiableSortedMap(SortedMa pm) 6. unmodifiableSortedSet(SortedSe ts) If ...
2012-08-30, 2179👍, 0💬

Two methods have key words static synchronized and synchronized separately. What is the difference between them?
Two methods have key words static synchronized and synchronized separately. What is the difference between them? Both are synchronized methods. One is instance method, the other is class method. Method with static modifier is a class method. That means the method belongs to class itself and can be a...
2012-08-30, 2236👍, 0💬

Is there any other way that you can achieve inheritance in Java?
Is there any other way that you can achieve inheritance in Java? There are a couple of ways. As you know, the straight way is to "extends" and/or "implements". The other way is to get an instance of the class to achieve the inheritance. That means to make the supposed-super-class be a field member. ...
2012-08-29, 2202👍, 0💬

What are the drawbacks of inheritance?
What are the drawbacks of inheritance? Since inheritance inherits everything from the super class and interface, it may make the subclass too clustering and sometimes error-prone when dynamic overriding or dynamic overloading in some situation. In addition, the inheritance may make peers hardly unde...
2012-08-29, 2321👍, 0💬

<< < 13 14 15 16 17 18 19 20 21 22 23 > >>   Sort: Rank