Java Programming docx

908 6.4K 0
Java Programming docx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

[...]... CREATING YOUR FIRST JAVA CLASSES » In this chapter, you will: Learn about programming Be introduced to object-oriented programming concepts Learn about Java Analyze a Java application that uses console output Add comments to a Java class Save, compile, run, and modify a Java application Create a Java application using GUI output Correct errors and find help 1 CREATING YOUR FIRST JAVA CLASSES JAVA ON THE JOB,... provided on the CD that comes with this book: » Sun Microsystems Java SE 6, the Java language, compiler, and runtime environment » Sun Microsystems Java Application Programming Interface (API) Specification, official documentation for the Java programming language » The jGRASP integrated development environment for Java » Code files for all Java program examples contained in the text VISIT OUR WORLD WIDE... OBJECT-ORIENTED PROGRAMMING CONCEPTS Two popular approaches to writing computer programs are procedural programming and object-oriented programming PROCEDURAL PROGRAMMING »NOTE Procedures are also called modules, methods, functions, and subroutines Users of different programming languages tend to use different terms Java programmers most frequently use the term “method.” Procedural programming is a style of programming. .. 805 APPENDIX A WORKING WITH THE JAVA PLATFORM 807 APPENDIX B LEARNING ABOUT ASCII AND UNICODE 815 APPENDIX C FORMATTING OUTPUT 821 APPENDIX D GENERATING RANDOM NUMBERS 833 APPENDIX E JAVADOC 839 GLOSSARY 847 INDEX 867 xviii PREFACE Java Programming, Fifth Edition provides the beginning programmer with a guide to developing applications using the Java programming language Java is popular among professional... example, if you misspell a programminglanguage word, you commit a syntax error, but if you use a correct word in the wrong context, you commit a semantic error 3 »NOTE You will learn more about debugging Java programs later in this chapter CREATING YOUR FIRST JAVA CLASSES »TWO TRUTHS AND A LIE: LEARNING ABOUT PROGRAMMING 1 Unlike a low-level programming language, a high-level programming language allows... (JVM) Figure 1-3 shows the Java environment Programming statements written in a high-level programming language are called source code When you write a Java program, you first construct the source code using a text editor such as Notepad The statements are saved in a file; then, the Java compiler converts the source code into a binary program of bytecode A program called the Java interpreter then checks... other programming languages, software vendors usually have to produce multiple versions of the same product 8 C H A P T E R O N E (a Windows version, Macintosh version, UNIX version, Linux version, and so on) so all users can run the program With Java, one program version will run on all these platforms Java Source Code Source code is stored on a disk in a file with a name ending in java Java Compiler Java. .. class Computer Operating System JVM (named java. exe) performs security checks and translates bytecodes to machine language, which executes Java Virtual Machine Figure 1-3 The Java environment Java is also simpler to use than many other object-oriented languages Java is modeled after C++ Although neither language is easy to read or understand on first exposure, Java does eliminate some of the most difficult-to-understand... LEARNING ABOUT JAVA 1 Java was developed to be architecturally neutral, which means that anyone can build an application without extensive study 2 After you write a Java program, the compiler converts the source code into a binary program of bytecode 3 Java programs that are embedded in a Web page are called applets, while stand-alone programs are called Java applications The false statement is #1 Java was... complete the steps and exercises, you need the following: » Software: Java SE 6, available from http:/ /java. sun.com (Although almost all of the examples in this » » book will work with earlier versions of Java, this book was created using Java 6.) The book clearly points out the few cases when an example does not work with earlier versions of Java You also need a text editor, such as Notepad A few exercises . YOUR FIRST JAVA CLASSES 1 LEARNING ABOUT PROGRAMMING 2 INTRODUCING OBJECT-ORIENTED PROGRAMMING CONCEPTS 4 Procedural Programming 4 Object-Oriented Programming. COMMENTS TO A JAVA CLASS 16 SAVING, COMPILING, RUNNING, AND MODIFYING A JAVA APPLICATION 18 Saving a Java Class 18 Compiling a Java Class 18 Running a Java Application

Ngày đăng: 06/03/2014, 03:20

Mục lục

  • READ THIS BEFORE YOU BEGIN

  • CHAPTER 1 CREATING YOUR FIRST JAVA CLASSES

    • LEARNING ABOUT PROGRAMMING

    • INTRODUCING OBJECT-ORIENTED PROGRAMMING CONCEPTS

      • Procedural Programming

      • Understanding Objects, Classes, and Encapsulation

      • Understanding Inheritance and Polymorphism

      • LEARNING ABOUT JAVA

        • Java Program Types

        • ANALYZING A JAVA APPLICATION THAT USES CONSOLE OUTPUT

          • Understanding the Statement That Prints the Output

          • Understanding the First Class

          • Understanding the main() Method

          • ADDING COMMENTS TO A JAVA CLASS

          • SAVING, COMPILING, RUNNING, AND MODIFYING A JAVA APPLICATION

            • Saving a Java Class

            • Compiling a Java Class

            • Running a Java Application

            • Modifying a Java Class

            • CREATING A JAVA APPLICATION USING GUI OUTPUT

            • CORRECTING ERRORS AND FINDING HELP

            • YOU DO IT

              • Your First Application

              • Adding Comments to a Class

              • Creating a Dialog Box

              • DON'T DO IT

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan