Catálogo de publicaciones - libros
SCJP Exam for J2SE 5: A Concise and Comprehensive Study Guide for The Sun Certified Java Programmer Exam
Paul Sanghera
Resumen/Descripción – provisto por la editorial
No disponible.
Palabras clave – provistas por la editorial
Software Engineering/Programming and Operating Systems
Disponibilidad
Institución detectada | Año de publicación | Navegá | Descargá | Solicitá |
---|---|---|---|---|
No detectada | 2006 | SpringerLink |
Información
Tipo de recurso:
libros
ISBN impreso
978-1-59059-697-5
ISBN electrónico
978-1-4302-0173-1
Editor responsable
Springer Nature
País de edición
Reino Unido
Fecha de publicación
2006
Información sobre derechos de publicación
© Apress 2006
Cobertura temática
Tabla de contenidos
Fundamentals of Java Programming
Paul Sanghera
The computer revolution continues after entering its latest phase, the Internet. Computers are not only in your office and home, but are everywhere: serving you from behind walls (e.g. automatic teller machines), sitting ready to protect you in your car by inflating the air bag in an accident, letting you work while enjoying your favorite cup of coffee in Starbucks (the laptop), powering projects such as the human genome project, and so on. The most popular application platform on computers is, of course, the World Wide Web, which is powering countless applications, such as e-commerce and e-mail applications, transforming the whole world in the process.
Part 1 - Scratching the Surface | Pp. 3-20
Data Types and Operators
Paul Sanghera
A computer program, written in any programming language, is basically made of three elements: data, operations on data, and the logic that determines the operations. Therefore, manipulating the data (i.e. holding and operating on it) is at the core of a typical computer program. The data is held by variables, and the operations are made by using what are called operators. Data handled by the program may come in different types, such as integer or character. Every language supports certain basic data types, called primitive data types. However, a given variable may hold data of one specific type only. As you know from Chapter 1, Java, in addition to supporting primitive data types, supports an infinite number of data types by letting you write classes. In this chapter, I discuss the primitive data types in detail, and introduce some nonprimitive data types built into the Java language.
Part 2 - Basic Java Programming | Pp. 23-56
Classes, Methods, and Interfaces
Paul Sanghera
As described in Chapter 2, a computer program, written in any programming language, is basically made of three elements: data, operations on data, and the logic that determines the operations. Chapter 2 discussed different types of data and the corresponding variables to handle the data. The smallest unit of a program that performs operations on data and holds the logic for these operations is called a function. In procedural languages such as C and Pascal, the data and functions are not closely bound together. The data flows in and out of the functions freely. This not only makes a program highly error prone but also increases its complexity. An object-oriented language, such as Java, offers the promise of binding the data and the operations on data (functions) together. In object-oriented terminology, functions are called methods. Therefore, in Java, the data and the methods that could operate on it are bound together into one entity, called a class.
Part 2 - Basic Java Programming | Pp. 57-87
Java Language Fundamentals
Paul Sanghera
In the previous chapter, you learned about classes, methods, and interfaces. In this chapter, we explore various aspects of a class and its members (variables and methods). You will learn how to organize your classes into an application. You will also learn what can happen to variables when you pass them as arguments in a method call. Another important issue covered in this chapter is from where in the application you can access a class or its members. This depends upon the access modifiers assigned to a class or its members. Modifiers modify (further specify) the behavior of a class or its members, and you can specify them when you write the code. Finally, you’ll learn how memory management is performed in Java. You instantiate a class into an object, and the object occupies some memory. You can free the memory from the object when you no longer need it, which is called garbage collection in Java.
Part 2 - Basic Java Programming | Pp. 89-119
Object-Oriented Programming
Paul Sanghera
Java is an object-oriented language that adapts itself to the real-world problem being solved as opposed to a procedural language that adapts the problem to itself. In this chapter, we explore some features of Java that make it possible to adapt the programs to the problem rather than the other way around. The real world and its problems are composed of objects such as a room, a classroom, a cow, and the cow’s tail. The objects in the real world also have relationships among themselves; for example, the classroom is a room, and the cow has a tail. You will see in this chapter how Java supports these object-oriented relationships.
Part 2 - Basic Java Programming | Pp. 121-151
Execution Flow Control in Java
Paul Sanghera
The order in which the code statements will be executed is an important component of the internal architecture of a program. In a given block, the program is executed sequentially one statement at a time starting from the first statement at the top and proceeding toward the bottom. This scheme, without any additional flow logic, will execute each statement precisely once. However, if a programming language is to allow you to write programs to solve real-life problems, it must recognize the conditional logic that is at work in real life. For example, if it is Sunday and sunny, you will go to the beach, if it is a weekday, you will go to work, there are a few things in life that you will do over and over again, and so on. Java, like most other languages, offers conditional flow logic for the program execution. A set of statements may be executed once, more than once, or skipped altogether, and the decision may be made at runtime (that is, at the time of program execution). This makes programming more dynamic, efficient, and powerful.
Part 2 - Basic Java Programming | Pp. 153-172
Exceptions and Assertions
Paul Sanghera
Errors do happen in a computer program. Generally speaking, there are two kinds of possible errors in a program. One kind happens due to problems originating from the execution environment, such as running out of memory, and is represented in Java by the class Error and its subclasses. The second kind of error, called an , happens due to problems originating inside the application itself, and is represented by the class Exception and its subclasses. When an exception happens, either there is code to handle it or it is ignored. If it is ignored, the program terminates. However, Java offers an extensive mechanism to handle exceptions. When an exception happens, the exception propagates, changing the normal execution control flow of the application. In other words, exceptions are the messengers that carry the bad news inside the world of an application. Programmers may use the exception-handling mechanism of Java to write well-behaved, robust Java applications.
Part 3 - Advanced Java Programming | Pp. 175-196
Input and Output in Java
Paul Sanghera
You already know that data and operations on data are important parts of a computer program. Sometimes your application will need to read input data from a file or write the output data to a file. Java offers classes in the java.io package to facilitate these input/output (I/O) operations. Data can be of various types, ranging from raw bytes to characters, to primitive data types, and to objects. Java treats I/O in a standard, uniform way in the form of streams. Conceptually, a stream on one end is connected to an I/O device (e.g. a file or a socket), to another stream (or a program), and ultimately to a program on the other end. The data flows between a program and the I/O device through these streams.
Part 3 - Advanced Java Programming | Pp. 197-220
Strings, Formatters, and Wrappers
Paul Sanghera
It is hard to imagine an application without data. An application typically receives data from an I/O device (for example, a file or a socket), processes (or produces) data, and sends it to another I/O device, and the data travels between the I/O device and the application in the form of streams. The processing of data includes parsing (splitting apart) the incoming data and formatting (putting together) the outgoing data. Both parsing and formatting can be done at data item levels (for example, strings, numbers, and dates) and at data stream levels. For example, you format the data items, and then format the stream of the data items, and send the stream. On the receiving end, you parse the stream to get hold of some data items, and then you can do parsing at data item levels to examine the item further. In data processing, handling strings (chains of characters) is a very important task for any programming language. In Java, String is an object, while primitive data types are not. Java offers a so-called wrapper class for each primitive data type so that the primitives can participate in object-like activities.
Part 3 - Advanced Java Programming | Pp. 221-257
Collections and Generics
Paul Sanghera
Everything in Java is an object. As you learned in Chapter 9, you can even make the primitive values act like objects by wrapping them in the wrapper classes. The wrapping and unwrapping of primitive values, which is also called boxing and unboxing, has been automated in J2SE 5.0 and is called . So, you can assume that all the data types in Java can be treated like objects of classes. All the objects in Java share some methods, which they inherit from the Object class at the root of the Java class hierarchy—that is, it is a superclass of all classes in Java.
Part 3 - Advanced Java Programming | Pp. 259-289