Introduction To Java Programming: Fairose Binti Mohtar
Introduction To Java Programming: Fairose Binti Mohtar
LEARNING OUTCOMES :
Upon completion of this course, the students should be able to:
1. Describe the features and basic concepts of Java language. 2. Write, compile Java source code and interpret Java byte code using Java Development Kit (JDK). 3. Implement the key of OOP concepts: classes and objects, inheritance and polymorphism. 4. Incorporate exception handling in Java Programming.
OBJECTIVE :
Understand Java Terminology And Environment :
1. 2. 3. 4. 5. 6. 7.
Data Abstraction - Refers to the concept of representing only the essential features of a data without including the non-essential details. Encapsulation - Refers to the mechanism of wrapping up of data and methods (that operate on the data) into a single unit (class). Inheritance - Refers to the concept by which one class derives the properties of another class.
Polymorphism - Refers to the response (output) of each object differently for the same input.
Introduction
Java Evolution
Year 1990 History
C++ was found not fit to control electronic devices. So research for a new programming language started. 1991-92 A new programming language OAK was found. Later renamed as JAVA. 1993-94 Java became a perfect language to develop Internet-based applications
1995
Java Architecture
Java is platform-independent as it can run on a wide variety of computers using different OS. There are four important components in Java architecture:
Java Source Code Java Compiler Java Byte code (Object code) Java Virtual Machine (JVM)
Java Source Code - Program written in the form of text using Java.
Java Compiler - Used to convert source code into binary program that consists of byte code. It creates .class file.
Java Byte Code (Object code) - Byte code is a set of instructions that are machine-independent. Executed by JVM. Java Virtual Machine (JVM) - Is a Java runtime system. Converts the bytecode in .class file to machine language.
Features in Java
Features in Java
Object-Oriented - This approach to design programs very close to the real world.
Platform-Independent - Java programs written in one environment can run on all other environments. Portable - Feature of bytecode and basic data types in Java makes it compatible with all systems.
Features in Java
Distributed - Java is powerful language to share and access data across the net. Robust - Java programs are reliable. Early checking and dynamic checking during runtime, mostly eliminates situations that cause errors. Secure - Java is a highly secure programming language. Multi-threaded - This concept enables Java programs to handle many tasks simultaneously.
C++ VS Java
Compilation model of C++ and Java
C++ VS Java
C++
Supports ASCII char set.
Java
Supports Unicode char set.
Supports pointers, structures, Does not support pointers, complex functions concepts. structures and complex functions concepts. Supports multiple inheritance. Does not support multiple inheritance. It can be supported through interface feature.
Compiler - javac is the Java compiler. It converts the source code to .class file with bytecode.
Interpreter - Java interpreter java is used to translate the bytecode to machine language code.
Applet Viewer - It is a tool used to view the applet programs created in Java.
Application Programs
Application programs are the stand-alone programs, which can execute from the command prompt.
Applet Programs
Applet programs are the Internet based programs, which can run in a Web-browser.
Summary
In this presentation, you learnt the following: 1. Java is a object oriented programming (OOP) language. 2. Java is found to be powerful for Internet applications.
3.
4.
5.
Java is platform-independent as it can run on wide variety of computers using different OS. Java compiler, javac converts source code of Java to the .class file with byte code. Java Virtual Machine (JVM) is Java runtime environment that converts bytecode to machine language.
Summary
In this presentation, you learnt the following: 6. The two types of Java program are Application and Applets. 7. The JDK tools are Compiler, Interpreter and Applet Viewer.
Review :
1. What is Java Virtual Machine?
2.