Priorities
Priorities The priority of a thread tells the scheduler how important this thread is. If there are a number of threads blocked and waiting to be run, the scheduler will run the one with the highest priority first. However, this doesn’t mean thaCiteste tot ... 1914 cuvinte
Dimensiune medie - fara imagini |
|
|
Arrays are first-class objects
Arrays are first-class objects Regardless of what type of array you’re working with, the array identifier is actually a handle to a true object that’s created on the heap. The heap object can be created either implicitly, as part of the array iCiteste tot ... 908 cuvinte
Dimensiune mica - fara poza |
|
|
Distinguishing overloaded methods
Distinguishing overloaded methods If the methods have the same name, how can Java know which method you mean? There’s a simple rule: Each overloaded method must take a unique list of argument types. If you think about this for a second, it maCiteste tot ... 123 cuvinte
Dimensiune mica - fara poza |
|
|
What is finalize( ) for
What is finalize( ) for? You might believe at this point that you should not use finalize( ) as a general-purpose cleanup method. What good is it? A third point to remember is: Garbage collection is only about memory. That iCiteste tot ... 1191 cuvinte
Dimensiune mica - fara poza |
|
|
Reflection: run-time class information
Reflection: run-time class information If you don’t know the precise type of an object, RTTI will tell you. However, there’s a limitation: the type must be known at compile time in order for you to be able to detect it using RTTI and do sometCiteste tot ... 1365 cuvinte
Dimensiune mica - fara poza |
|
|
Creating your own exceptions
Creating your own exceptions You’re not stuck using the Java exceptions. This is important because you’ll often need to create your own exceptions to denote a special error that your library is capable of creating, but which was not foreseen whCiteste tot ... 456 cuvinte
Dimensiune mica - fara poza |
|
|
Runnable revisited
Runnable revisited Earlier in this chapter, I suggested that you think carefully before making an applet or main Frame as an implementation of Runnable. If you take that approach, you can make only one of those threads in your program. This limCiteste tot ... 988 cuvinte
Dimensiune mica - fara poza |
|
|
Controlling layout: FlowLayout, GridLayout
Controlling layout The way that you place components on a form in Java is probably different from any other GUI system you’ve used. First, it’s all code; there are no “resources” that control placement of components. Second, the way componentsCiteste tot ... 1281 cuvinte
Dimensiune mica - fara poza |
|
|
Typical uses of IO streams: Input streams
Typical uses of IO streams Although there are a lot of IO stream classes in the library that can be combined in many different ways, there are just a few ways that you’ll probably end up using them. However, they require attention to get the cCiteste tot ... 1819 cuvinte
Dimensiune medie - fara imagini |
|
|
List boxes
List boxes List boxes are significantly different from Choice boxes, and not just in appearance. While a Choice box drops down when you activate it, a List occupies some fixed number of lines on a screen all the time and doesn’t change. In addCiteste tot ... 981 cuvinte
Dimensiune mica - fara poza |
|
|
Java 1.1 UI APIs: Desktop colors
Java 1.1 UI APIs Java 1.1 has also added some important new functionality, including focus traversal, desktop color access, printing “inside the sandbox,” and the beginnings of clipboard support. Focus traversal is quite easy, since it’s traCiteste tot ... 1948 cuvinte
Dimensiune medie - fara imagini |
|
|
The Microsoft way: J/Direct
The Microsoft way At the time of this writing, Microsoft does not support JNI, but provides proprietary support to call non-Java code. This support is built into the compiler, the Microsoft JVM, and external tools. The features described in thiCiteste tot ... 2191 cuvinte
Dimensiune medie - fara imagini |
|
|
Using Sets
Using Sets Set has exactly the same interface as Collection, so there isn’t any extra functionality as there is with the two different Lists. Instead, the Set is exactly a Collection, it just has different behavior. (This is the ideal use of inCiteste tot ... 526 cuvinte
Dimensiune mica - fara poza |
|
|
Enumerators (iterators)
Enumerators (iterators) In any collection class, you must have a way to put things in and a way to get things out. After all, that’s the primary job of a collection – to hold things. In the Vector, addElement( ) is the way that you insertCiteste tot ... 694 cuvinte
Dimensiune mica - fara poza |
|
|
Multiple dispatching
Multiple dispatching The above design is certainly satisfactory. Adding new types to the system consists of adding or modifying distinct classes without causing code changes to be propagated throughout the system. In addition, RTTI is not “misuCiteste tot ... 1230 cuvinte
Dimensiune mica + cu imagini |
|
|
Creating unique package names
Creating unique package names You might observe that, since a package never really gets “packaged” into a single file, a package could be made up of many .class files, and things could get a bit cluttered. To prevent this, a logical thing to doCiteste tot ... 972 cuvinte
Dimensiune mica - fara poza |
|
|
Java/COM integration
Java/COM integration COM (formerly known as OLE) is the Microsoft Component Object Model, the foundation of all ActiveX technologies. These include ActiveX Controls, Automation, and ActiveX Documents. But COM is much more; it’s a specificationCiteste tot ... 3451 cuvinte
Dimensiune medie - fara imagini |
|
|
Labels
Labels A Label does exactly what it sounds like it should: places a label on the form. This is particularly important for text fields and text areas that don’t have labels of their own, and can also be useful if you simply want to place textualCiteste tot ... 489 cuvinte
Dimensiune mica - fara poza |
|
|
“Multiple inheritance” in Java
“Multiple inheritance” in Java The interface isn’t simply a “more pure” form of abstract class. It has a higher purpose than that. Because an interface has no implementation at all – that is, there is no storage associated with an interface – tCiteste tot ... 762 cuvinte
Dimensiune mica + cu imagini |
|
|
A compendium of operators
A compendium of operators The following example shows which primitive data types can be used with particular operators. Basically, it is the same example repeated over and over, but using different primitive data types. The file will compile wiCiteste tot ... 355 cuvinte
Dimensiune mica - fara poza |
|
|
Alte pagini