Connecting Java to CGI
Connecting Java to CGI A Java program can send a CGI request to a server just like an HTML page can. As with HTML pages, this request can be either a GET or a POST. In addition, the Java program can intercept the output of the CGI program, so yCiteste tot ... 3860 cuvinte
Dimensiune medie - fara imagini |
|
|
Constructor initialization
Constructor initialization The constructor can be used to perform initialization, and this gives you greater flexibility in your programming since you can call methods and perform actions at run time to determine the initial values. There’s oneCiteste tot ... 969 cuvinte
Dimensiune mica - fara poza |
|
|
Calling constructors from constructors
Calling constructors from constructors When you write several constructors for a class, there are times when you’d like to call one constructor from another to avoid duplicating code. You can do this using the this keyword. Normally, when yCiteste tot ... 461 cuvinte
Dimensiune mica - fara poza |
|
|
Using Lists
Using Lists List (interface) Order is the most important feature of a List; it promises to maintain elements in a particular sequence. List adds a number of methods to Collection that allow insertion and removal of elemCiteste tot ... 435 cuvinte
Dimensiune mica - fara poza |
|
|
do-while
do-while The form for do-while is do statement while(Boolean-expression); The sole difference between while and do-while is that the statement of the do-while always executes at least once, even if the expression evaluates to false theCiteste tot ... 53 cuvinte
Dimensiune mica - fara poza |
|
|
Guaranteeing proper cleanup
Guaranteeing proper cleanup Java doesn’t have the C++ concept of a destructor, a method that is automatically called when an object is destroyed. The reason is probably that in Java the practice is simply to forget about objects rather than to dCiteste tot ... 565 cuvinte
Dimensiune mica - fara poza |
|
|
Visual programming and Beans
Visual programming and Beans So far in this book you’ve seen how valuable Java is for creating reusable pieces of code. The “most reusable” unit of code has been the class, since it comprises a cohesive unit of characteristics (fields) and behCiteste tot ... 3544 cuvinte
Dimensiune medie - fara imagini |
|
|
private: you can’t touch that
private: you can’t touch that! The private keyword that means no one can access that member except that particular class, inside methods of that class. Other classes in the same package cannot access private members, so it’s as if you’re evenCiteste tot ... 351 cuvinte
Dimensiune mica - fara poza |
|
|
Text processing: Extracting code listings
Text processing If you come from a C or C++ background, you might be skeptical at first of Java’s power when it comes to handling text. Indeed, one drawback is that execution speed is slower and that could hinder some of your efforts. However,Citeste tot ... 4830 cuvinte
Dimensiune medie - fara imagini |
|
|
Making local copies: Pass by value
Making local copies To review: all argument passing in Java is performed by passing handles. That is, when you pass “an object,” you’re really passing only a handle to an object that lives outside the method, so if you perform any modificationsCiteste tot ... 3401 cuvinte
Dimensiune medie - fara imagini |
|
|
Inheritance syntax
Inheritance syntax Inheritance is such an integral part of Java (and OOP languages in general) that it was introduced in Chapter 1 and has been used occasionally in chapters before this one because certain situations required it. In addition, yCiteste tot ... 684 cuvinte
Dimensiune mica - fara poza |
|
|
Adding attributes and useful interfaces: FilterInputStream
Adding attributes and useful interfaces The use of layered objects to dynamically and transparently add responsibilities to individual objects is referred to as the decorator pattern. (Patterns[1] are the subject of Chapter 16.) The decoratorCiteste tot ... 1232 cuvinte
Dimensiune mica - fara poza |
|
|
Abstracting usage
Abstracting usage With creation out of the way, it’s time to tackle the remainder of the design: where the classes are used. Since it’s the act of sorting into bins that’s particularly ugly and exposed, why not take that process and hide it insCiteste tot ... 680 cuvinte
Dimensiune mica + cu imagini |
|
|
Sorting and searching: Arrays
Sorting and searching Java 1.2 adds utilities to perform sorting and searching for arrays or Lists. These utilities are static methods of two new classes: Arrays for sorting and searching arrays, and Collections for sorting and searching Lists.Citeste tot ... 828 cuvinte
Dimensiune mica - fara poza |
|
|
break and continue
break and continue Inside the body of any of the iteration statements you can also control the flow of the loop by using break and continue. break quits the loop without executing the rest of the statements in the loop. continue stops the execCiteste tot ... 248 cuvinte
Dimensiune mica - fara poza |
|
|
Designing with inheritance - Pure inheritance vs. extension
Designing with inheritance Once you learn about polymorphism, it can seem that everything ought to be inherited because polymorphism is such a clever tool. This can burden your designs; in fact if you choose inheritance first when you’re usingCiteste tot ... 1140 cuvinte
Dimensiune mica + cu imagini |
|
|
Object serialization: Controlling serialization
Object serialization Java 1.1 has added an interesting feature called object serialization that allows you to take any object that implements the Serializable interface and turn it into a sequence of bytes that can later be restored fully into tCiteste tot ... 3986 cuvinte
Dimensiune medie - fara imagini |
|
|
A custom tool library
A custom tool library With this knowledge, you can now create your own libraries of tools to reduce or eliminate duplicate code. Consider, for example, creating an alias for System.out.println( ) to reduce typing. This can be part of a pacCiteste tot ... 510 cuvinte
Dimensiune mica - fara poza |
|
|
Composition syntax
Composition syntax Until now, composition has been used quite frequently. You simply place object handles inside new classes. For example, suppose you’d like an object that holds several String objects, a couple of primitives and an object of anCiteste tot ... 501 cuvinte
Dimensiune mica - fara poza |
|
|
Multiple threads: Inheriting from Thread
Multiple threads Objects provide a way to divide a program up into independent sections. Often, you also need to turn a program into separate, independently-running subtasks. Each of these independent subtasks is called a thread, and you progCiteste tot ... 3300 cuvinte
Dimensiune medie - fara imagini |
|
|
Alte pagini