<< < 9 10 11 12 13 14 15 16 17 18 19 > >>   Sort: Date

What is polymorphism?
What is polymorphism? Polymorphism means "having many forms". It allows methods (may be variables) to be written that needn't be concerned about the specifics of the objects they will be applied to. That is, the method can be specified at a higher level of abstraction and can be counted on to work e...
2012-08-14, 2443👍, 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, 2441👍, 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, 2441👍, 0💬

Is sizeof a keyword?
Is sizeof a keyword? The sizeof operator is not a keyword.
2012-10-01, 2436👍, 0💬

If my class already extends from some other class what should I do if I want an instance of my class to be thrown as an exceptio
If my class already extends from some other class what should I do if I want an instance of my class to be thrown as an exception object? One can not do anytihng in this scenarion. Because Java does not allow multiple inheritance and does not provide any exception interface as well.
2013-05-30, 2433👍, 0💬

There are two classes: A and B. The class B need to inform a class A when some important event has happened. What Java techniqu
There are two classes: A and B. The class B need to inform a class A when some important event has happened. What Java technique would you use to implement it? If these classes are threads I'd consider notify() or notifyAll(). For regular classes you can use the Observer interface.
2013-04-19, 2432👍, 0💬

Explain the usage of Java packages.
Explain the usage of Java packages. This is a way to organize files when a project consists of multiple modules. It also helps resolve naming conflicts when different packages have classes with the same names. Packages access level also allows you to protect data from being used by the non-authorize...
2012-08-09, 2432👍, 0💬

Can you write a Java class that could be used both as an applet as well as an application?
Can you write a Java class that could be used both as an applet as well as an application? A. Yes. Add a main() method to the applet.
2012-08-20, 2431👍, 0💬

What is the SimpleTimeZone class?
What is the SimpleTimeZone class? The SimpleTimeZone class provides support for a Gregorian calendar.
2012-07-04, 2430👍, 0💬

What is an abstract method?
What is an abstract method? An abstract method is a method whose implementation is deferred to a subclass.
2012-11-01, 2425👍, 0💬

What is a task's priority and how is it used in scheduling?
What is a task's priority and how is it used in scheduling? A task's priority is an integer value that identifies the relative order in which it should be executed with respect to other tasks. The scheduler attempts to schedule higher priority tasks before lower priority tasks.
2012-10-12, 2425👍, 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, 2424👍, 0💬

What is the purpose of the wait(), notify(), and notifyAll() methods?
What is the purpose of the wait(), notify(), and notifyAll() methods? The wait(),notify(), and notifyAll() methods are used to provide an efficient way for threads to wait for a shared resource. When a thread executes an object's wait() method, it enters the waiting state. It only enters the ready s...
2012-10-31, 2422👍, 0💬

How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8 characters?
How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8 characters? Unicode requires 16 bits and ASCII require 7 bits. Although the ASCII character set uses only 7 bits, it is usually represented as 8 bits. UTF-8 represents characters using 8, 16, and 18 bit patterns. UTF-16 uses 16-bi...
2012-09-27, 2422👍, 0💬

What is the Collections API?
What is the Collections API? The Collections API is a set of classes and interfaces that support operations on collections of objects.
2012-09-21, 2420👍, 0💬

What is the difference between a static and a non-static inner class?
What is the difference between a static and a non-static inner class? A non-static inner class may have object instances that are associated with instances of the class's outer class. A static inner class does not have any object instances.
2012-11-06, 2419👍, 0💬

Can a top level class be private or protected?
Can a top level class be private or protected? No. A top level class can not be private or protected. It can have either "public" or no modifier. If it does not have a modifier it is supposed to have a default access.If a top level class is declared as private the compiler will complain that the "mo...
2013-05-15, 2416👍, 0💬

What are the legal operands of the instanceof operator?
What are the legal operands of the instanceof operator? The left operand is an object reference or null value and the right operand is a class, interface, or array type.
2013-01-01, 2415👍, 0💬

Whats the difference between notify() and notifyAll()?
Whats the difference between notify() and notifyAll()? notify() is used to unblock one waiting thread; notifyAll() is used to unblock all of them. Using notify() is preferable (for efficiency) when only one blocked thread can benefit from the change (for example, when freeing a buffer back into a po...
2013-02-15, 2414👍, 0💬

What comes to mind when you hear about a young generation in Java?
What comes to mind when you hear about a young generation in Java? Garbage collection.
2013-04-14, 2413👍, 0💬

What happens when a thread cannot acquire a lock on an object?
What happens when a thread cannot acquire a lock on an object? If a thread attempts to execute a synchronized method or synchronized statement and is unable to acquire an object's lock, it enters the waiting state until the lock becomes available.
2012-11-14, 2410👍, 0💬

What does it mean that a method or field is "static"?
What does it mean that a method or field is "static"? Static variables and methods are instantiated only once per class. In other words they are class variables, not instance variables. If you change the value of a static variable in a particular object, the value of that variable changes for all in...
2013-06-20, 2409👍, 0💬

What is the Locale class?
What is the Locale class? The Locale class is used to tailor program output to the conventions of a particular geographic, political, or cultural region.
2012-10-25, 2408👍, 0💬

If an object is garbage collected, can it become reachable again?
If an object is garbage collected, can it become reachable again? Once an object is garbage collected, it ceases to exist. It can no longer become reachable again.
2013-01-02, 2407👍, 0💬

<< < 9 10 11 12 13 14 15 16 17 18 19 > >>   Sort: Date