Вы находитесь на странице: 1из 14

CT038-3-2 Object Oriented Development with Java Overview of Java Language

Topic & Structure of the lesson



CT038-3-2 OODJ

Introduction to Java Java Features Program Structure Java Tokens Java Statements Implementing a Java Program Java Virtual Machine
Overview of Java

Learning outcomes
At the end of this lecture you should be able to: Identify the Java features. Familiarize with the basic Java Program Structure and syntax. Identify different types of Java Tokens and Java Statements.

CT038-3-2 OODJ

Overview of Java

Key terms you must be able to use


If you have mastered this topic, you should be able to use the following terms correctly in your assignments and exams: Identifier main public static void
CT038-3-2 OODJ Overview of Java

Introduction to Java
Java is a Object Oriented programming language developed by Sun Microsystems.

CT038-3-2 OODJ

Overview of Java

Java Features
Compiled & Interpreted Platform Independent & Portable Object Oriented Robust & Secure Distributed Multithreaded

CT038-3-2 OODJ

Overview of Java

Program Structure
Example A simple Java Program class SampleOne { public static void main(String args[ ]) { System.out.println(Hello Java); } }
CT038-3-2 OODJ Overview of Java

Class declaration Opening & Closing Brace The main line The output line

CT038-3-2 OODJ

Overview of Java

Java Tokens
Smallest individual units in a program are known as tokens. Basically, a Java program is a collection of tokens, comments and white spaces. Includes 5 types of tokens : Reserved keywords Identifiers Literals Operators Separators
CT038-3-2 OODJ Overview of Java

Java Statements
A statement is an executable combination of tokens ending with a semicolon mark. Some examples:
Statement Expression Selection Iteration Jump
CT038-3-2 OODJ

Example Assignment, increment if, if-else, switch while, do, for break, continue, return
Overview of Java

Implementing a Java Program


Involves three steps. They include: Creating the program Compiling the program Running the program

CT038-3-2 OODJ

Overview of Java

Java Virtual Machine


All language compilers translates source code into machine code for a specific computer. The Java compiler produces an intermediate code known as bytecode for a machine. This machine is JVM that exist only inside the computer memory.

CT038-3-2 OODJ

Overview of Java

Java Program

Java Compiler

JVM

My program

Source code

Bytecode

CT038-3-2 OODJ

Overview of Java

Summary
Java is a Object Oriented Language. Classes are fundamental building blocks of Java programs. Every Java application contains a class with a main method.

CT038-3-2 OODJ

Overview of Java

Вам также может понравиться