<< < 19 20 21 22 23 24 25 26 27 > >>   Sort: Date

If I want an object of my class to be thrown as an exception object, what should I do?
If I want an object of my class to be thrown as an exception object, what should I do? The class should extend from Exception class. Or you can extend your class from some more precise exception type also.
2013-05-30, 1937👍, 0💬

I made my class Cloneable but I still get 'Can't access protected method clone. Why?
I made my class Cloneable but I still get 'Can't access protected method clone. Why? Yeah, some of the Java books, in particular "The Java Programming Language", imply that all you have to do in order to have your class support clone() is implement the Cloneable interface. Not so. Perhaps that was t...
2013-02-07, 1937👍, 0💬

You can create an abstract class that contains only abstract methods. On the other hand, you can create an interface that declar
You can create an abstract class that contains only abstract methods. On the other hand, you can create an interface that declares the same methods. So can you use abstract classes instead of interfaces? Sometimes. But your class may be a descendent of another class and in this case the interface is...
2013-04-14, 1936👍, 0💬

Why Thread is faster compare to process?
Why Thread is faster compare to process? A thread is never faster than a process. If you run a thread(say there's a process which has spawned only one thread) in one JVM and a process in another and that both of them require same resources then both of them would take same time to execute. But, when...
2013-03-21, 1934👍, 0💬

WWhat is the difference between static and non-static variables?
WWhat is the difference between static and non-static variables? A static variable is associated with the class as a whole rather than with specific instances of a class. Non-static variables take on unique values with each object instance.
2013-06-12, 1933👍, 0💬

Give a simplest way to find out the time a method takes for execution without using any profiling tool?
Give a simplest way to find out the time a method takes for execution without using any profiling tool? Read the system time just before the method is invoked and immediately after method returns. Take the time difference, which will give you the time taken by a method for execution. To put it in co...
2013-05-24, 1933👍, 0💬

Why isn't there operator overloading?
Why isn't there operator overloading? Because C++ has proven by example that operator overloading makes code almost impossible to maintain. In fact there very nearly wasn't even method overloading in Java, but it was thought that this was too useful for some very basic methods like print(). Note tha...
2013-02-11, 1933👍, 0💬

Can an Interface be final?
Can an Interface be final? yes.
2013-02-04, 1933👍, 0💬

What is the difference between a field variable and a local variable?
What is the difference between a field variable and a local variable? A field variable is a variable that is declared as a member of a class. A local variable is a variable that is declared local to a method.
2012-12-25, 1933👍, 0💬

What is an Iterator?
What is an Iterator? Some of the collection classes provide traversal of their contents via a java.util.Iterator interface. This interface allows you to walk through a collection of objects, operating on each object in turn. Remember when using Iterators that they contain a snapshot of the collectio...
2013-04-29, 1932👍, 0💬

What is JVM?
What is JVM? JVM stands for Java Virtual Machine. It is the run time for java programs. All are java programs are running inside this JVM only. It converts java byte code to OS specific commands. In addition to governing the execution of an application's byte codes, the virtual machine handles relat...
2013-03-13, 1932👍, 0💬

What modifiers may be used with a top-level class?
What modifiers may be used with a top-level class? A top-level class may be public, abstract, or final.
2013-01-25, 1932👍, 0💬

What is the difference between preemptive scheduling and time slicing?
What is the difference between preemptive scheduling and time slicing? Under preemptive scheduling, the highest priority task executes until it enters the waiting or dead states or a higher priority task comes into existence. Under time slicing, a task executes for a predefined slice of time and the...
2013-06-07, 1931👍, 0💬

What is meant by "Abstract Interface"?
What is meant by "Abstract Interface"? First, an interface is abstract. That means you cannot have any implementation in an interface. All the methods declared in an interface are abstract methods or signatures of the methods.
2013-04-06, 1931👍, 0💬

When does the compiler supply a default constructor for a class?
When does the compiler supply a default constructor for a class? The compiler supplies a default constructor for a class if no other constructors are provided.
2012-12-14, 1931👍, 0💬

Is null a keyword?
Is null a keyword? The null value is not a keyword.
2013-02-14, 1930👍, 0💬

What is synchronization and why is it important?
What is synchronization and why is it important? With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is possible for one thread to modify a shared object while another thread is in the process of...
2013-02-12, 1930👍, 0💬

What is HashMap and Map?
What is HashMap and Map? Map is Interface and Hashmap is class that implements that.
2013-04-25, 1928👍, 0💬

What is the difference between an Interface and an Abstract class?
What is the difference between an Interface and an Abstract class? An abstract class can have instance methods that implement a default behavior. An Interface can only declare constants and instance methods, but cannot implement default behavior and all methods are implicitly abstract. An interface ...
2013-04-22, 1928👍, 0💬

What will be the output on executing the following code .
What will be the output on executing the following code . What will be the output on executing the following code. public class MyClass { public static void main (String args[] ) { int abc[] = new int [5]; System.out.println(abc); } } A Error array not initialized B 5 C null D Print some junk charac...
2013-03-08, 1928👍, 0💬

Describe the wrapper classes in Java.
Describe the wrapper classes in Java. Wrapper class is wrapper around a primitive data type. An instance of a wrapper class contains, or wraps, a primitive value of the corresponding type. Following table lists the primitive types and the corresponding wrapper classes: Primitive Wrapper boolean java...
2013-03-05, 1928👍, 0💬

What are runtime exceptions?
What are runtime exceptions? Runtime exceptions are those exceptions that are thrown at runtime because of either wrong input data or because of wrong business logic etc. These are not checked by the compiler at compile time.
2013-05-28, 1925👍, 0💬

Difference between Vector and ArrayList?
Difference between Vector and ArrayList? Vector is synchronized whereas arraylist is not.
2013-04-26, 1925👍, 0💬

What is JIT?
What is JIT? JIT stands for Just In Time compiler. It compiles java byte code to native code.
2013-03-13, 1925👍, 0💬

<< < 19 20 21 22 23 24 25 26 27 > >>   Sort: Date