Sie sind auf Seite 1von 4

About the Author A Note from the Consulting Editor Instructor-led training is proven to be an effective and popular tool

for traini ng engineers and developers. To convey technical ideas and concepts, the classroom experience is shown to be superior when compared to other delivery methods. As a technical trainer for more than 20 years, I have seen the effectiveness of instr uctor-led training firsthand. 60 Minutes a Day combines the best of the instructor-led tra ining and book experience. Technical training is typically divided into short and disc rete modules, where each module encapsulates a specific topic; each module is then fo llowed by questions and answers and a review. 60 Minutes a Day titles follow the same model: each chapter is short, discrete, and can be completed in 60 minutes a day. For these books, I have enlisted premier technical trainers as authors. They pro vide the voice of the trainer and demonstrate classroom experience in each book of th e series. You even get an opportunity to meet the actual trainer: As part of this innovative approach, each chapter of a 60 Minutes a Day book is presented online by the author. Readers are encouraged to view the online presentation before reading th e relevant chapter. Therefore, 60 Minutes a Day delivers the complete classroom experience even the trainer. As an imprint of Wiley Publishing, Inc., Gearhead Press continues to bring you, the reader, the level of quality that Wiley has delivered consistently for nearly 20 0 years. Thank you. Donis Marshall Founder, Gearhead Press Consulting Editor, Wiley Technology Publishing Group

Introduction

To my wife, Susan, for her motivation and support, and to our children, Megan, Ryan, Katelyn, and Emma, for letting me use the computer for hours at a time.

Picture 1 : The group

Lab 1 : Getting Started With Java Lab 1.1: Your First Java Program Picture 1.1 : Ilustrator In this lab, you will write a Java program that uses the System. out.prinlnt() method to display an email signature (name, title, email address, and so forth). Perform the following steps: Create a new subdirectory in your javafiles directory, called Lab1_1, using your text editor, start with a public class called Signature.Add the main() method w ithin the Signature class, within main(), use the System.out.println() method to print your

name at the command prompt, similarly, print your title on a line, then your ema il address, Web URL, or phone numbers. (Display any information you want in your signature. Just remember to use a semicolon after each println() statement.), save your Signature source code in the Lab1_1 folder in a file called Signature.java. Lab 1.2: Using Command-Line Arguments When you run a Java program from the command prompt, you can input arguments that get passed to the main() method as strings. For example, suppose that you entered the following command to run your Signature java Signature hello 27 Rich Raposa This command has three command-line arguments beyond the java Signature command: hello, 27, and Rich Raposa. (Arguments are separated by spaces unless placed in double quotes.) These three arguments are passed into main() and placed in the args parameter. The args parameter is an array of strings that can hold as many command-line arguments as you enter. To access these arguments within main(), you use args with a subscript in square brackets. For example, args[0] is the first argument, args[1] is the second, and so on. In the current example, args[0] will be the string hello, args[1] will be 27, and args[2] will be Rich Raposa. In this lab, you will display the title and author of a book, where the title and author are entered as command-line arguments such as: Title: Green Eggs and Ham Author: Dr. Seuss Lab 2 : Java Fundamentals Picture 2 : Image Symbol Java This chapter builds your foundation for using the Java programming language. It discusses the details of the fundamentals of Java. The keywords are discussed as well as how to declare identifiers and variables. The chapter also discusses literals, constants, strings, references, and the Java arithmetic operators.

Lab 2.1 : Java Keywords The keywords of a programming language are the words that define the language, have special meaning to the compiler, and cannot be used as identifiers. Lab 2.1.1 : Identifiers Identifiers are those words in your Java code that you choose. For example, in you wrote a class named Signature. Signature is not a Java keyword, nor does it have any special meaning in Java. You had to name the class somethin g, and Signature was chosen to make the code more readable because the program displayed an email signature. Lab 2.2 : Variables Variables are used to store data. In Java, a variable needs to be declared. Declaring a variable involves two steps: giving the variable a name and stating what type of data is to be stored in the variable.

<<table.jpg>> Eight type data in java Lab 3 : Control Structures In this chapter, I will discuss the control structures of the Java language, cov ering decision making and repetition. Topics in this chapter include a discussion on Boolean logic, truth tables, the if/else statement, the switch statement, the for loop, and while and do/while loops. If you are new to programming, spend some time in this chapter. Control structures are fundamental to any programming language, not just Java. If you are already familiar with structures like if statements and while loops, pay close attention to the details of how these are implemented in Java. Lab 4 : Classes and Objects Lab 4.1 : Procedural Programming In the early days of programming, programs were designed using flowcharts and a sort of top-down design. With this type of design, a large problem is solved by breaking it down into smaller tasks. For each of the smaller tasks, a procedure is written. One main procedure was written to start the process and subsequently flow through to the solution, invoking the desired procedures along the way. Lab 4.2 : Object-Oriented Programming Object-oriented programming (OOP) originated from research done by Xerox s Palo Alto Research Center (PARC) in the 1970s. OOP takes an entirely different approach to developing computer applications. Instead of designing a program around the tasks that are to be solved, a program is designed around the objects in the problem domain. Lab 4.3 : Object-Oriented Analysis and Design Programs written with an object-oriented language revolve around the objects in the problem domain, not the individual tasks that need to be performed in solving the problem. How you decide what the objects are and what the objects look like is an important but unique process.

Das könnte Ihnen auch gefallen