Содержание
- 2. What is a Computer? A computer is an electronic device that stores and processes data. A
- 3. CPU The central processing unit (CPU) is the brain of a computer. It retrieves(gets) instructions(directives) from
- 4. Memory Memory is to store data and program instructions for CPU to execute. A memory unit
- 5. How Data is Stored? Data of various kinds, such as numbers, characters, and strings, are encoded
- 6. Storage Devices Memory is volatile, because information is lost when the power is off. Programs and
- 7. Output Devices: Monitor Monitor and printer are the most widely used output devices. The monitor displays
- 8. Communication Devices A regular modem uses a phone line and can transfer data in a speed
- 9. Programs Computer programs, known as software, are instructions (directions) to the computer. You tell a computer
- 10. Programming Languages Machine Language Assembly Language High-Level Language Machine language is a set of primitive (basic)
- 11. Programming Languages Machine Language Assembly Language High-Level Language Assembly languages were developed to make programming easy.
- 12. Programming Languages Machine Language Assembly Language High-Level Language The high-level languages are English-like and easy to
- 13. Popular High-Level Languages
- 14. Interpreting/Compiling Source Code A program written in a high-level language is called a source program or
- 15. Interpreting Source Code An interpreter reads one statement from the source code, translates it to the
- 16. Compiling Source Code A compiler translates the entire source code into a machine-code file, and the
- 17. Operating Systems The operating system (OS) is a program that manages and controls a computer’s activities.
- 18. Why Java? The answer is that Java enables users to develop and deploy applications on the
- 19. Java, Web, and Beyond Java can be used to develop standalone applications. Java can be used
- 20. Java’s History James Gosling and Sun Microsystems Developed by James Gosling’s team at Sun Microsystems Oak
- 21. JDK Versions JDK 1.02 (1995) JDK 1.1 (1996) JDK 1.2 (1998) JDK 1.3 (2000) JDK 1.4
- 22. JDK Editions Java Standard Edition (J2SE) J2SE can be used to develop client-side standalone applications or
- 23. Popular Java IDEs NetBeans Eclipse
- 24. Installing Java and Eclipse First install the Java, then Eclipse Java SE Download http://www.oracle.com/technetwork/java/javase/downloads/index.html Eclipse Download
- 25. A Simple Java Program // This program prints Welcome to Java! public class Welcome { public
- 26. Creating and Editing Using NotePad To use NotePad, type notepad Welcome.java from the DOS prompt.
- 27. Creating, Compiling, and Running Programs You save a Java program in a .java file and compile
- 28. Compiling Java Source Code With Java, you write the program once, and compile the source program
- 29. Trace a Program Execution // This program prints Welcome to Java! public class Welcome { public
- 30. Trace a Program Execution // This program prints Welcome to Java! public class Welcome { public
- 31. Trace a Program Execution // This program prints Welcome to Java! public class Welcome { public
- 32. Two More Simple Examples WelcomeWithThreeMessages ComputeExpression Animation Animation
- 33. Compiling and Running Java from the Command Window Set path to JDK bin directory set path=c:\Program
- 34. Anatomy of a Java Program Class name Main method Statements Statement terminator Reserved words Comments Blocks
- 35. Class Name Every Java program must have at least one class. Each class has a name.
- 36. Main Method In order to run a class, the class must contain a method named main.
- 37. Statement A statement represents an action or a sequence of actions. The statement System.out.println("Welcome to Java!")
- 38. Statement Terminator // This program prints Welcome to Java! public class Welcome { public static void
- 39. Reserved words Reserved words or keywords are words that have a specific meaning to the compiler
- 40. Blocks A pair of braces in a program forms a block that groups components of a
- 41. Special Symbols
- 42. { … } // This program prints Welcome to Java! public class Welcome { public static
- 43. ( … ) // This program prints Welcome to Java! public class Welcome { public static
- 44. ; // This program prints Welcome to Java! public class Welcome { public static void main(String[]
- 45. // … // This program prints Welcome to Java! public class Welcome { public static void
- 46. " … " // This program prints Welcome to Java! public class Welcome { public static
- 47. Programming Style Good programming style make a program easy to read and help programmers prevent errors.
- 48. Appropriate Comments Include a summary at the beginning of the program to explain what the program
- 49. Naming Conventions Choose meaningful and descriptive names. Class names: Capitalize the first letter of each word
- 50. Proper Indentation and Spacing Indentation Indent two spaces. Spacing Use blank line to separate segments of
- 51. Block Styles Use end-of-line style for braces.
- 52. Programming Errors Programming errors can be categorized into three types: Syntax Errors Detected by the compiler
- 53. Syntax Errors public class ShowSyntaxErrors { public static main(String[] args) { System.out.println("Welcome to Java); } }
- 54. Runtime Errors public class ShowRuntimeErrors { public static void main(String[] args) { System.out.println(1 / 0); }
- 55. Logic Errors public class ShowLogicErrors { public static void main(String[] args) { System.out.println("Celsius 35 is Fahrenheit
- 57. Скачать презентацию