<< < 6 7 8 9 10 11 12 13 14 15 16 > >>   Sort: Date

What is the catch or declare rule for method declarations?
What is the catch or declare rule for method declarations? If a checked exception may be thrown within the body of a method, the method must either catch the exception or declare it in its throws clause.
2012-10-11, 2278👍, 0💬

Calculating Most Frequent Number
Can you write a computer code for the following problem: Given an online stream of infinite numbers, print out the most frequent number. Here is a solution in Java: import java.io.*; import java.util.*; public class MostFrequent { public static void main(String[] a) { int mapMax = 99; // Most freque...
2013-12-19, 2277👍, 0💬

What is the difference between the Boolean & operator and the && operator?
What is the difference between the Boolean & operator and the && operator? If an expression involving the Boolean & operator is evaluated, both operands are evaluated. Then the & operator is applied to the operand. When an expression involving the && operator is evaluated...
2012-07-03, 2277👍, 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, 2274👍, 0💬

How does Java handle integer overflows and underflows?
How does Java handle integer overflows and underflows? It uses those low order bytes of the result that can fit into the size of the type allowed by the operation.
2012-09-24, 2273👍, 0💬

What value does read() return when it has reached the end of a file?
What value does read() return when it has reached the end of a file? The read() method returns -1 when it has reached the end of a file.
2012-11-05, 2272👍, 0💬

How can a subclass call a method or a constructor defined in a superclass?
How can a subclass call a method or a constructor defined in a superclass? Use the following syntax: super.myMethod(); To call a constructor of the superclass, just write super(); in the first line of the subclass's constructor.
2012-07-05, 2272👍, 0💬

In System.out.println(),what is System,out and println,pls explain?
In System.out.println(),what is System,out and println,pls explain? System is a predefined final class,out is a PrintStream object acting as a field member and println is a built-in overloaded method in the out object.
2012-08-20, 2270👍, 0💬

If I write return at the end of the try block, will the finally block still execute?
If I write return at the end of the try block, will the finally block still execute? Yes even if you write return as the last statement in the try block and no exception occurs, the finally block will execute. The finally block will execute and then the control return.
2013-06-04, 2269👍, 0💬

Can an object's finalize() method be invoked while it is reachable?
Can an object's finalize() method be invoked while it is reachable? An object's finalize() method cannot be invoked by the garbage collector while the object is still reachable. However, an object's finalize() method may be invoked by other objects.
2012-10-03, 2269👍, 0💬

What advantage do Java's layout managers provide over traditional windowing systems?
What advantage do Java's layout managers provide over traditional windowing systems? Java uses layout managers to lay out components in a consistent manner across all windowing platforms. Since Java's layout managers aren't tied to absolute sizing and positioning, they are able to accommodate platfo...
2012-07-25, 2267👍, 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, 2266👍, 0💬

What is the difference between the File and RandomAccessFile classes?
What is the difference between the File and RandomAccessFile classes? The File class encapsulates the files and directories of the local file system. The RandomAccessFile class provides the methods needed to directly access data contained in any part of a file.
2012-08-06, 2265👍, 0💬

Explain the usage of the keyword transient?
Explain the usage of the keyword transient? This keyword indicates that the value of this member variable does not have to be serialized with the object. When the class will be de-serialized, this variable will be initialized with a default value of its data type (i.e. zero for integers).
2012-07-31, 2263👍, 0💬

What modifiers may be used with an inner class that is a member of an outer class?
What modifiers may be used with an inner class that is a member of an outer class? A (non-local) inner class may be declared as public, protected, private, static, final, or abstract.
2012-06-20, 2261👍, 0💬

What is the advantage of the event-delegation model over the earlier event-inheritance model?
What is the advantage of the event-delegation model over the earlier event-inheritance model? The event-delegation model has two advantages over the event-inheritance model. First, it enables event handling to be handled by objects other than the ones that generate the events (or their containers). ...
2012-10-30, 2258👍, 0💬

What restrictions are placed on method overriding?
What restrictions are placed on method overriding? Overridden methods must have the same name, argument list, and return type. The overriding method may not limit the access of the method it overrides. The overriding method may not throw any exceptions that may not be thrown by the overridden method...
2012-07-30, 2258👍, 0💬

What are use cases?
What are use cases? A use case describes a situation that a program might encounter and what behavior the program should exhibit in that circumstance. It is part of the analysis of a program. The collection of use cases should, ideally, anticipate all the standard circumstances and many of the extra...
2012-08-15, 2256👍, 0💬

Why is multiple inheritance not possible in Java?
Why is multiple inheritance not possible in Java? It depends on how you understand "inheritance". Java can only "extends" one super class, but can "implements" many interfaces; that doesn't mean the multiple inheritance is not possible. You may use interfaces to make inheritance work for you. Or you...
2012-08-27, 2253👍, 0💬

What is the purpose of the finally clause of a try-catch-finally statement?
What is the purpose of the finally clause of a try-catch-finally statement? The finally clause is used to provide the capability to execute code no matter whether or not an exception is thrown or caught.
2012-07-09, 2253👍, 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, 2251👍, 0💬

What is the difference between a Window and a Frame?
What is the difference between a Window and a Frame? The Frame class extends Window to define a main application window that can have a menu bar.
2012-07-13, 2251👍, 0💬

Parsers? DOM vs SAX parser
Parsers? DOM vs SAX parser Parsers are fundamental xml components, a bridge between XML documents and applications that process that XML. The parser is responsible for handling xml syntax, checking the contents of the document against constraints established in a DTD or Schema. DOM 1. Tree of nodes ...
2012-08-23, 2246👍, 0💬

What comes to mind when someone mentions a shallow copy in Java?
What comes to mind when someone mentions a shallow copy in Java? Object cloning.
2013-04-15, 2244👍, 0💬

<< < 6 7 8 9 10 11 12 13 14 15 16 > >>   Sort: Date