OCP Java SE 7 Programmer II Certification Guide: Prepare for the 1ZO-804 exam

OCP Java SE 7 Programmer II Certification Guide: Prepare for the 1ZO-804 examReviews
Author: Mala Gupta
Pub Date: 2015
ISBN: 978-1617291487
Pages: 832
Language: English
Format: PDF
Size: 11 Mb

Download

The OCP Java 7 certification tells potential employers that you’ve mastered the language skills you need to design and build professional-quality Java software. Passing the OCP isn’t just about knowing your Java, though. You have to also know what to expect on the exam and how to beat the built-in tricks and traps.
OCP Java SE 7 Programmer II Certification Guide is a comprehensive, focused study guide that prepares you to pass the OCP exam the first time you take it. It systematically guides you through each exam objective, reinforcing the Java skills you need through examples, exercises, and cleverly constructed visual aids. In every chapter you’ll find questions just like the ones you’ll face on the real exam. Tips, diagrams, and review notes give structure to the learning process to improve your retention. Designed for readers with intermediate-level Java skills.
What’s Inside

  • 100% coverage of the OCP Java SE 7 Programmer II exam (1Z0-804)
  • Flowcharts, UML diagrams, and other visual aids
  • Hands-on coding exercises
  • Focuses on passing the exam, not the Java language itself
+

Java class design

Class design decisions require an insight into understanding correct and appropriate implementation practices. When armed with adequate information you’ll be able
to select the best practices and approach to designing your classes. The topics covered in this chapter will help you design better classes by taking you through multiple
examples. This chapter covers

Object-oriented design principles

Have you ever tried to find out the secret(s) behind the most successful people? Almost all agree to follow a set of lifelong principles. So, articles like “Three Common Habits of the Most Successful People” might include points similar to these:

  • Never hit the snooze button when the alarm goes off in the morning, so you aren’t delaying your actions.
  • First things first: prioritize your work.
  • Follow your passion and do what you love, because you’ll be working almost all your life.

These are the principles that successful people follow (though perhaps in a different manner) to achieve the greatest height of success.

Similarly, object-oriented design (OOD) principles enable you to create better application designs, which are manageable and extensible. For example, as a programmer or designer, you know that application requirements typically change. Implementing these modified needs requires changes in the existing code, which usually introduces bugs. Chances are that if the application design implements OOD principles, the modification task will require comparatively less effort. Again, as an example, if your application’s design uses the design principles of low coupling and high cohesion, chances are low that changes in a class will affect another class.

Java I/O fundamentals

The Java I/O API is powerful and flexible. It enables you to read and write multiple types of data: raw bytes, characters, and even objects. You can read data from multiple and diverse data sources such as files, network sockets, and memory arrays, and write them to multiple data destinations. Java I/O also provides the flexibility of reading or writing buffered and unbuffered data. You can also chain multiple input and output sources. You can use the same methods to read from an input resource such as a file, a console, or a network connection.

The Java I/O API is huge and could be a textbook on its own. Coverage in this chapter is limited to the Java I/O exam topics for the OCP Java SE 7 Programmer II exam. This chapter assumes no prior knowledge of Java I/O.

Going back to the basics, a computer system reads and writes all data as binary data (0s and 1s, referred to as bits) from all sources and to all destinations. A byte stream
reads and write bytes (8 bits) to and from data sources. All the other I/O classes build on the byte streams, adding more functionality. For example, character streams take
into account Unicode characters and the user’s charset. Instead of reading or writing 8-bit data from or to a file, character streams define methods to read or write 16-bit
data. But behind the scenes they use byte streams to get their work done. Figure 7.3 shows the input and output streams for reading and writing byte and character data.
As mentioned earlier, the exam covers writing data to and reading data from only files. A Java application uses…