Java-Programming-LE-1.pdf
Document Details
Uploaded by Deleted User
Tags
Full Transcript
Wear Mask & Face Shield. STAY SAFE AND HEALTHY. STAY AT HOME AND CONNECTED. Turn on Camera. Turn off Mic. Dress appropriately. Be Discipline and (at least 10 minutes) Respectful always....
Wear Mask & Face Shield. STAY SAFE AND HEALTHY. STAY AT HOME AND CONNECTED. Turn on Camera. Turn off Mic. Dress appropriately. Be Discipline and (at least 10 minutes) Respectful always. Wash Hands. 2 meters Social Distancing SHS in San Nicholas III, Bacoor City Stay at home. Wash hands. Wear face mask. Follow social distancing. SHS in San Nicholas III, Bacoor City At the end of the session, learners are expected to: Stay at home. a.Define Java Programming; b.Identify the phases Java Program; and Wash hands. c.Appreciate the importance of Java Programming in the field of Computer Science / Information and Wear face mask. Communications Technology. Follow social distancing. SHS in San Nicholas III, Bacoor City The learners demonstrate an understanding of the principles and Stay at home. concepts in demonstrating knowledge of Java technology and Java programming Wash hands. language and performing object-oriented analysis and design. Wear face mask. Follow social distancing. SHS in San Nicholas III, Bacoor City LO 1. Apply basics of Java language Stay at home. Wash hands. Wear face mask. Follow social distancing. SHS in San Nicholas III, Bacoor City Minimum Hardware Configuration Microsoft Windows operating systems: Stay at home. Processor: 500 MHz Intel Pentium III workstation or equivalent Wash hands. Memory: 384 megabytes Wear face mask. Disk space: 125 megabytes of free disk space Follow social distancing. SHS in San Nicholas III, Bacoor City SolarisTM operating system: Processor: 450 MHz UltraTM 10 workstation or equivalent Stay at home. Memory: 384 megabytes Disk space: 125 megabytes of free disk space Linux operating system: Wash hands. Processor: 500 MHz Intel Pentium III workstation or equivalent Memory: 384 megabytes Wear face mask. Disk space: 125 megabytes of free disk space Follow social distancing. SHS in San Nicholas III, Bacoor City Recommended Hardware Configuration Microsoft Windows operating systems: Stay at home. Processor: 780 MHz Intel Pentium III workstation or equivalent Wash hands. Memory: 512 megabytes Wear face mask. Disk space: 125 megabytes of free disk space Follow social distancing. SHS in San Nicholas III, Bacoor City SolarisTM operating system: Processor: 500 MHz UltraTM 60 workstation or Stay at home. equivalent Memory: 512 megabytes Wash hands. Disk space: 125 megabytes of free disk space Wear face mask. Follow social distancing. SHS in San Nicholas III, Bacoor City Operating System NetBeans IDE runs on operating systems that support the JavaTM VM. Below is a list of platforms Stay at home. that NetBeans IDE has been tested on. Microsoft Windows XP Professional SP1 Wash hands. Microsoft Windows 2000 Professional SP3 Solaris operating system (SPARC ® Platform Edition), versions 8, 9, and 10 Solaris operating system (x86 Platform Edition), versions 8, 9, and 10 Wear face mask. Follow social distancing. SHS in San Nicholas III, Bacoor City Red Hat Linux 9.0 Red Hat Enterprise Linux 3 Stay at home. Sun Java Desktop System NetBeans IDE is also known to run on the following platforms: Wash hands. Various other Linux distributions Mac OS X 10.1.1 or later Open VMS 7.2-1 or later Wear face mask. Other UNIX® platforms, such as HP-UX Follow social distancing. SHS in San Nicholas III, Bacoor City Software NetBeans IDE runs on the J2SE JDK 5.0 (JavaTM 2 JDK, Standard Edition), Stay at home. which consists of the Java Runtime Environment plus developers tools for compiling, debugging, and running applications written in the JavaTM language. Wash hands. NetBeans IDE 4.0 has also been tested on J2SE SDK version 1.4.2. For more information, please visit: http://www.netbeans.org/community/releases/40/relnotes.html Wear face mask. Follow social distancing. SHS in San Nicholas III, Bacoor City Turn on Camera. (at least 10 minutes) Turn off Microphone. Dress Appropriately. Be Discipline and Respectful always. Java Background SHS in San Nicholas III, Bacoor City A little Bit of History Java was created in 1991 by James Gosling et al. of Sun Microsystems. Initially called Oak, in honor of the tree outside Gosling's window, its name was changed to Java Stay at home. because there was already a language called Oak. The original motivation for Java was the need for platform independent language that could be embedded in various Wash hands. consumer electronic products like toasters and refrigerators. One of the first projects developed using Java was a personal hand- held remote control named Star 7. Wear face mask. Follow social distancing. Java Background SHS in San Nicholas III, Bacoor City At about the same time, the World Wide Web and the Internet were gaining Stay at home. popularity. Gosling et. al. realized that Java could be used for Internet programming. Wash hands. Wear face mask. Follow social distancing. Java Background SHS in San Nicholas III, Bacoor City At about the same time, the World Wide Web and the Internet were gaining Stay at home. popularity. Gosling et. al. realized that Java could be used for Internet programming. Wash hands. Wear face mask. Follow social distancing. SHS in San Nicholas III, Bacoor City Turn on Camera. (at least 10 minutes) Turn off Microphone. Dress Appropriately. Be Discipline and Respectful always. What is Java Technology? SHS in San Nicholas III, Bacoor City A programming language As a programming language, Java can create all kinds of Stay at home. applications that you could create using any conventional programming language. Wash hands. A development environment As a development environment, Java technology provides you with a large suite of tools: a compiler, an Wear face mask. interpreter, a documentation generator, a class file packaging tool, and so on. Follow social distancing. What is Java Technology? An application environment SHS in San Nicholas III, Bacoor City Java technology applications are typically general-purpose programs that run on any machine where the Java runtime environment (JRE) is installed. Stay at home. A deployment environment There are two main deployment environments: First, the JRE Wash hands. supplied by the Java 2 Software Development Kit (SDK) contains the complete set of class files for all the Java technology packages, which includes basic language classes, GUI component classes, and so on. The other main Wear face mask. deployment environment is on your web browser. Most commercial browsers supply a Java technology interpreter and runtime environment. Follow social distancing. SHS in San Nicholas III, Bacoor City Turn on Camera. (at least 10 minutes) Turn off Microphone. Some Features of Java Dress Appropriately. Be Discipline and Respectful always. The Java Virtual Machine SHS in San Nicholas III, Bacoor City The Java Virtual Machine is an imaginary machine that is implemented by emulating Stay at home. software on a real machine. The JVM provides the hardware platform specifications to which you compile all Java technology code. This Wash hands. specification enables the Java software to be platform-independent because the compilation Wear face mask. is done for a generic machine known as the JVM. Follow social distancing. The Java Virtual Machine SHS in San Nicholas III, Bacoor City A bytecode is a special machine language that can be understood by the Java Virtual Stay at home. Machine (JVM). The bytecode is independent of any particular computer hardware, so any computer with a Java interpreter can execute Wash hands. the compiled Java program, no matter what type of computer the program was compiled Wear face mask. on. Follow social distancing. Garbage Collection SHS in San Nicholas III, Bacoor City Many programming languages allows a programmer to allocate memory during runtime. Stay at home. However, after using that allocated memory, there should be a way to deallocate that memory block in order for other programs to use it again. In C, Wash hands. C++ and other languages the programmer is responsible for this. This can be difficult at times since there can be instances wherein the Wear face mask. programmers forget to deallocate memory and therefor result to what we call memory leaks Follow social distancing. Garbage Collection SHS in San Nicholas III, Bacoor City Many programming languages allows a programmer to allocate memory during runtime. Stay at home. However, after using that allocated memory, there should be a way to deallocate that memory block in order for other programs to use it again. In C, Wash hands. C++ and other languages the programmer is responsible for this. This can be difficult at times since there can be instances wherein the Wear face mask. programmers forget to deallocate memory and therefor result to what we call memory leaks Follow social distancing. Garbage Collection SHS in San Nicholas III, Bacoor City In Java, the programmer is freed from the burden of having to deallocate that Stay at home. memory themselves by having what we call the garbage collection thread. The Wash hands. garbage collection thread is responsible for freeing any memory that Wear face mask. can be freed. This happens automatically during the lifetime of the Java program. Follow social distancing. Code Security SHS in San Nicholas III, Bacoor City Code security is attained in Java through the implementation of its Java Stay at home. Runtime Environment (JRE). The JRE runs code compiled for a JVM and Wash hands. performs class loading (through the class loader), code verification (through the Wear face mask. bytecode verifier) and finally code execution. Follow social distancing. Code Security SHS in San Nicholas III, Bacoor City The Class Loader is responsible for loading all classes needed for the Java program. It adds security Stay at home. by separating the namespaces for the classes of the local file system from those that are imported from network sources. This limits any Trojan horse Wash hands. applications since local classes are always loaded first. After loading all the classes, the memory layout of the executable is then determined. This adds Wear face mask. protection against unauthorized access to restricted areas of the code since the memory layout is determined during runtime Follow social distancing. Code Security SHS in San Nicholas III, Bacoor City After loading the class and layouting of memory, the bytecode verifier then Stay at home. tests the format of the code fragments and checks the code fragments for illegal Wash hands. code that can violate access rights to objects. Wear face mask. After all of these have been done, the code is then finally executed. Follow social distancing. Code Security SHS in San Nicholas III, Bacoor City After loading the class and layouting of memory, the bytecode verifier then Stay at home. tests the format of the code fragments and checks the code fragments for Wash hands. illegal code that can violate access rights to objects. Wear face mask. After all of these have been done, the code is then finally executed. Follow social distancing. Phases of a Java Program SHS in San Nicholas III, Bacoor City The following figure describes the process of compiling and executing a Java program. Stay at home. One time only Everytime Wash hands. JAVA JAVA EDITOR COMPILER INTERPRETER Wear face mask. Hello.java Hello.class Follow social distancing. Phases of a Java Program SHS in San Nicholas III, Bacoor City The first step in creating a Java program is by writing your programs in a text editor. Examples of text editors you can use are notepad, vi, emacs, etc. This file is Stay at home. stored in a disk file with the extension.java. After creating and saving your Java program, compile the program by using the Java Compiler. The output of Wash hands. this process is a file of Java bytecodes with the file extension.class. The.class file is then interpreted by the Java interpreter Wear face mask. that converts the bytecodes into the machine language of the particular computer you are using. Follow social distancing. Summary of Phases of a Java Program SHS in San Nicholas III, Bacoor City Stay at home. Wash hands. Wear face mask. Follow social distancing. Java SHS in San Nicholas III, Bacoor City A programming language specifies the words and symbols that we can use to write a program Stay at home. The Java programming language was created by Sun Microsystems, Inc. Wash hands. Wear face mask. Object Oriented Programming 1-33 Follow social distancing. Java Platform Editions SHS in San Nicholas III, Bacoor City A Java Platform is the set of APIs, class libraries, and other programs used in developing Java programs for specific applications There are 3 Java Platform Editions Stay at home. 1. Java SE (Standard Edition)- formerly J2SE Core Java Platform targeting applications running on workstations Wash hands. 2. Java EE (Enterprise Edition) –formerly J2EE Component-based approach to developing distributed, multi-tier enterprise applications 3. Java ME (Mobile Edition), formerly J2ME Wear face mask. Targeted at small, stand-alone or connectable consumer and embedded devices Follow social distancing. Java Development Kit (JDK) SHS in San Nicholas III, Bacoor City Java Development Kit (JDK) Is a set of Java tools for developing Java programs Consists of Java API, Java Compiler, and JVM Java Application Programming Interface (API) Stay at home. Is prewritten code, organized into packages of similar topics Java Virtual JDK Machine (JVM) Wash hands. Is an JRE execution engine that runs compiled Java MyProgram.java byte code Java API Java Virtual Machine Wear face mask. Hardware - Based Platform Follow social distancing. SHS in San Nicholas III, Bacoor City Programming Java Curriculum Guide Programming Java NCIII Training Stay at home. Regulations Wash hands. Introduction to Programming I Author Florence Tiu Balagtas Wear face mask. Follow social distancing.