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

Why can't I say just abs() or sin() instead of Math.abs() and Math.sin()?
Why can't I say just abs() or sin() instead of Math.abs() and Math.sin()? The import statement does not bring methods into your local name space. It lets you abbreviate class names, but not get rid of them altogether. That's just the way it works, you'll get used to it. It's really a lot safer this ...
2013-02-15, 1904👍, 0💬

For which statements does it make sense to use a label?
For which statements does it make sense to use a label? The only statements for which it makes sense to use a label are those statements that can enclose a break or continue statement.
2012-11-27, 1903👍, 0💬

What are generations in Garbage Collection terminolgy? What is its relevance?
What are generations in Garbage Collection terminolgy? What is its relevance? Garbage Collectors make assumptions about how our application runs. Most common assumption is that an object is most likely to die shortly after it was created: called infant mortality. This assumes that an object that has...
2013-03-22, 1901👍, 0💬

What happens to the static fields of a class during serialization?
What happens to the static fields of a class during serialization? There are three exceptions in which serialization doesnot necessarily read and write to the stream. These are 1. Serialization ignores static fields, because they are not part of ay particular state state. 2. Base class fields are on...
2013-05-23, 1899👍, 0💬

When you serialize an object, what happens to the object references included in the object?
When you serialize an object, what happens to the object references included in the object? The serialization mechanism generates an object graph for serialization. Thus it determines whether the included object references are serializable or not. This is a recursive process. Thus when an object is ...
2013-05-22, 1895👍, 0💬

Primitive data types are passed by reference or pass by value?
Primitive data types are passed by reference or pass by value? Primitive data types are passed by value.
2013-05-16, 1894👍, 0💬

When and How is an object considered as Garbage by a GC?
When and How is an object considered as Garbage by a GC? An object is considered garbage when it can no longer be reached from any pointer in the running program. The most straightforward garbage collection algorithms simply iterate over every reachable object. Any objects left over are then conside...
2013-03-21, 1893👍, 0💬

What is the difference between static and non-static variables?
What 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.
2012-12-11, 1893👍, 0💬

How do I serialize an object to a file?
How do I serialize an object to a file? The class whose instances are to be serialized should implement an interface Serializable. Then you pass the instance to the ObjectOutputStream which is connected to a fileoutputstream. This will save the object to a file.
2013-05-20, 1892👍, 0💬

What are the steps in the JDBC connection?
What are the steps in the JDBC connection? While making a JDBC connection we go through the following steps : Step 1 : Register the database driver by using : Class.forName(" driver classs for that specific database" ); Step 2 : Now create a database connection using : Connection con = DriverManager...
2013-06-15, 1890👍, 0💬

What is the difference between a while statement and a do statement?
What is the difference between a while statement and a do statement? A while statement checks at the beginning of a loop to see whether the next loop iteration should occur. A do statement checks at the end of a loop to see whether the next iteration of a loop should occur. The do statement will alw...
2013-06-12, 1889👍, 0💬

What is Overriding?
What is Overriding? When a class defines a method using the same name, return type, and arguments as a method in its superclass, the method in the class overrides the method in the superclass. When the method is invoked for an object of the class, it is the new definition of the method that is calle...
2013-05-10, 1888👍, 0💬

Objects are passed by value or by reference?
Objects are passed by value or by reference? Java only supports pass by value. With objects, the object reference itself is passed by value and so both the original reference and parameter copy both refer to the same object .
2013-05-17, 1887👍, 0💬

When to Use the Throughput Collector?
When to Use the Throughput Collector? Use the throughput collector when you want to improve the performance of your application with larger numbers of processors. In the default collector garbage collection is done by one thread, and therefore garbage collection adds to the serial execution time of ...
2013-03-25, 1887👍, 0💬

What is the difference between a constructor and a method?
What is the difference between a constructor and a method? A constructor is a member function of a class that is used to create objects of that class. It has the same name as the class itself, has no return type, and is invoked using the new operator. A method is an ordinary member function of a cla...
2013-04-29, 1886👍, 0💬

What are the restrictions placed on static method ?
What are the restrictions placed on static method ? We cannot override static methods. We cannot access any object variables inside static method. Also the this reference also not available in static methods.
2013-03-12, 1886👍, 0💬

What are new language features in J2SE 5.0?
What are new language features in J2SE 5.0? Generally: 1. generics 2. static imports 3. annotations 4. typesafe enums 5. enhanced for loop 6. autoboxing/unboxing 7. varargs 8. covariant return types
2013-03-07, 1885👍, 0💬

What is a marker interface ?
What is a marker interface ? An interface that contains no methods. Eg: Serializable, Cloneable, SingleThreadModel etc. It is used to just mark java classes that support certain capability.
2013-03-11, 1883👍, 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[0]); } } A Error array not initialized B 5 C 0 D Print some junk chara...
2013-03-11, 1881👍, 0💬

What are synchronized methods and synchronized statements?
What are synchronized methods and synchronized statements? Synchronized methods are methods that are used to control access to an object. A thread only executes a synchronized method after it has acquired the lock for the method's object or class. Synchronized statements are similar to synchronized ...
2013-06-13, 1880👍, 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-08, 1880👍, 0💬

What are ClassLoaders?
What are ClassLoaders? A class loader is an object that is responsible for loading classes. The class ClassLoader is an abstract class. Given the name of a class, a class loader should attempt to locate or generate data that constitutes a definition for the class. A typical strategy is to transform ...
2013-03-14, 1879👍, 0💬

What are synchronized methods and synchronized statements?
What are synchronized methods and synchronized statements? Synchronized methods are methods that are used to control access to an object. A thread only executes a synchronized method after it has acquired the lock for the method's object or class. Synchronized statements are similar to synchronized ...
2013-06-18, 1877👍, 0💬

What are checked exceptions?
What are checked exceptions? Checked exception are those which the Java compiler forces you to catch. e.g. IOException are checked Exceptions.
2013-05-28, 1875👍, 0💬

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