michellebacayplacide
14 views
31 slides
Oct 15, 2024
Slide 1 of 31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
About This Presentation
java
Size: 10.52 MB
Language: en
Added: Oct 15, 2024
Slides: 31 pages
Slide Content
JAVA
MODULE JAVA
TOPIC ONE TOPIC TWO TOPIC THREE TOPIC FOUR TOPIC FIVE ICT 12
LESSON 1- JAVA PROGRAMMING OBJECTIVES: At the end of the lesson the learners will able to: Describe the history of Java Explain the design goals behind Java Identify various Java versions TOPIC ONE TOPIC TWO TOPIC THREE TOPIC FOUR TOPIC FIVE
Introduction to Java Jav a is a general-purpose and object-oriented programming language developed for the distributed environment and software development for consumer electronic devices such as TVs , VCRs , toasters , etc. Java Programming Language is a platform-independent language , which means there is no limitation to any particular hardware or operating system . It provides users the facility to ‘write once, run anywhere’. TOPIC ONE TOPIC TWO TOPIC THREE TOPIC FOUR TOPIC FIVE
History of Java Java first appeared in the year 1995 as Oak . They also decided to call this language the project Green , before it could find its popularity as Java by finding its roots in coffee , which in turn is attributed to Java- an island in Indonesia . TOPIC ONE TOPIC TWO TOPIC THREE TOPIC FOUR TOPIC FIVE
History of Java The first version 1.0 of Java came in 1996 when Sun Microsystems promised the principle of WORA (Write Once, Run Anywhere) property. Then Java 2 (J2SE 1.2) was introduced in December 1998-1999. J2EE(Java Enterprise Editions) was for enterprise applications. In 2006, Sun renamed new J2 versions as Java EE, Java ME, and Java SE. September 2018 marked the release of Java SE 11 (LTS). March 2019 marked the release of Java SE 12 (LTS). On September 10th, 2019, Java SE 13 was released. Java SE 14 came in March 2020, which is the latest version of Java. TOPIC ONE TOPIC TWO TOPIC THREE TOPIC FOUR TOPIC FIVE
FEATURES OF JAVA Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue massa. Fusce posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit amet commodo magna eros quis urna. TOPIC ONE TOPIC TWO TOPIC THREE TOPIC FOUR TOPIC FIVE
MEMBERS CHRISTINE MICHELLE MERRIC NATHANIEL LINDSAY
DESIGN GOALS BEHIND JAVA LANGUAGE Simple, Object- Oriented , and Familiar Object-oriented programming (“OOP” for short) was conceived to model real-world object. In OOP, a class defines the common variables (attributes) and methods (functions) of objects. An object is a instance of a class. For example, all human have common attribute: name, age birthday, etc : and function getting old or growing up.
ROBUST AND SECURE Java has a certain degree of fault- tolerance, which is a property that allows a platform to continue to function in the event of a failure or an error. Java also has good exception handling when running your program. Even after you compile your program, the Java Virtual Machine perform security checks when executing the code.
Architecture Neutral and Portable The Java API is the component that allows you to write your program. The Java API can be used with Integrated Development Environments (IDEs) such as Net Beans, Eclipse, and Blue J to make programming languages before once you compile your program, you should be able to run it right away on your computer as an executable file. With Java, the compiler generates “bytecode” file which is an architecture neutral format used to transport code across various hardware and software platforms, and even various versions of the java programming language.
JAVA CODE WRITTEN CAN BE EXECUTED ALMOST ANYWHERE Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue massa. Fusce posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit amet commodo magna eros quis urna. High Performance High Performance Computing (HPC) are application that aim to solve complex computational problems. Certain Characteristics of Java make it an ideal candidate to program high performance computing application . Since hardware advancement keep on moving forward, having the latest and faster hardware help HPC applications must then be portable to adapt to constant hardware upgrades. HPC applications are normally running within a network or via distributed computing and Java has built-in support for distributed system.
INTERPRETED, THREADED, AND DYNAMIC By “interpreted,” we refer to how the Java bytecodes are interpreted by the Java Virtual Machine regardless of the hardware and software platforms Java’s interpreted nature has been discussed earlier but one of the benefits of having an interpreted language in faster development cycle.
Version of Java We can learn more about what kind of applications use Java by knowing the different versions of Java available: Java Standard Edition ( JSE)- This is the default Java version that allows us to develop applications for desktops, servers, and small embedded environments such as SIM cards and SMART cards. It also provides the creation of a rich user interface. These applications serve a small number of users at a time.
LESSON 2 Objectives: At the end of the lesson the learners will be able to: Use NetBeans IDE. Explain the given sample program YOR FIRST JAVA PROGRAM
Programming Java with NET BEANS NetBeans is an integrated development environment (IDE) for Java . NetBeans allows applications to be developed from a set of modular software components called modules. NetBeans runs on Windows , macOS , Linux and Solaris . In addition to Java development, it has extensions for other languages like PHP , C , C++ , HTML5 , [3] and JavaScript . Applications based on NetBeans, including the NetBeans IDE, can be extended by third party developers . [4]
Creating Java Programs with NETBEANS 1. Run NETBEANS by double-clicking on the NETBEANS icon on your desktop or from the Start menu. After the application has loaded, create a new project by clicking Project > New Project. 2. New Project dialog box will appear. In the File name field, input the name of your project. Click Create. 3. The NETBEANS window will look similar to the following picture. Double-click this icon to open READ.TXT. 4.Type the appropriate information. 5. After updating README.TXT, click Class > Close. 6. Click Edit > New Class or press Ctrl+N at the same time.
Creating Java Programs with NETBEANS 7. Type “Welcome” as the name of the new class then click Ok. 8.Double-click the Welcome icon to open the Welcome class 9. Delete all the included within the editor and type the following: 10. Click Class > Close or press Ctrl+W at the same time. 11. Create another class and name it Main . Edit the Main class by double-clicking the Main icon. Delete all the text included within the editor and type the following:
Executing Your Program Using NETBEANS 1. Right-click the Main icon and select void main (string[] args ). 2. Click Ok. 3. The terminal window of NETBEANS will appear to show the output. A. When a line is highlighted, it is an indication that there is an error on that line. In this case, the error is the letter "w” in welcome () is in lowercase. Since the Welcome class we created has a capital letter, it should be in uppercase as well. B. Line 8 is highlighted but the error is not in line 8 but in the previous line - line 7. Apparently, the previous line has no semicolon to end the statement. There are times that the compiler may be reporting an error on a line but the real error is on another line. This kind of error reporting normally happens when a semicolon is missing at the end of a line of code.
Executing Your Program Using NETBEANS C. Line 5 is highlighted. It seems correct but f you look closely, the “1” (letter “1”) in println is actually a “1” (one). When you can’t figure out the error at times, the best thing to do is to retype your code. Aside from the error message on the status bar, BlueJ also provides its users with suggestions on possible causes of the detected error through dialog boxes which will appear if you click the question mark. You will be eventually taught how each command or line of code affects your programs in the next lessons.
Analyzing Welcome. Java We started our Welcome class with a single line comment, as seen in line 1 of the program. A comment is read by the Java compiler but is not executed as a command. Any text that follows two slash symbols (//) is considered as a single line comment.
Analyzing Welcome. Java Line 2 defines the beginning of the Welcome class. When you declare a class public, it can be accessed and used by other classes. Note that there is also an open brace on line 3 to indicate the start of the scope of the class. Line 8 has the close brace which ends the scope of the class. To declare a class here is the syntax:
Analyzing Welcome. Java In Welcome.java, the access modifier is Public while the class name is Welcome. Line 4 shows the start of the method printWelcome (). Methods or functions are pieces of code with instructions on how to perform an action in a program. The syntax for defining a method is:
Analyzing Welcome. Java In Welcome.java, void is the return type for the user-defined method printWelcome ()- A method with a void return type returns nothing but this does not mean that the method doesn't do anything. In Welcome.java, the method printWelcome () will print the words Welcome to Java when called. Line 6 shows how to print text in Java. The method println () is an example of a native Java method that displays the message inside the parenthesis on the screen, and then the cursor is placed on the next line. If you want your cursor to stay on the same line and go to the next available space after printing, use the print () method instead of println () Just like a class declaration, methods also use braces to designate the start and end or a method. You can see the braces for the method in lines 5 and 7.
Analyzing Welcome. Java Line 5 shows how an object is defined in Java. Here, the object Greet is created. The word is user defined. (You can even have your name in its place!). The general syntax for defining an object in Java is: The keyword new indicates that we are creating a new object using a particular class. In our present program, we are not using arguments but in the following lessons we will learn that passing arguments can be essential for some types of programs. For example, we can create a program that calculates the area of a square. Our program will contain the formula to compute the area of a square, but whenever we use it, we need to input the value that will be used by the formula. The creation of objects is one of the ways that the Object Oriented Programming (OOP)paradigm is made efficient and unique. We will learn more about OOP concepts in later lessons.
Analyzing Welcome. Java Line 6 illustrates how a method of a class is called . If you look at the Welcome class , you’ll notice that we declared a method named printWelcome () . By declaring an instance of the Welcome class (in this case, the Greet variable is an instance of the Welcome class, courtesy of line 5), you can execute a method within the specific class. The basic syntax is: