SOFTWARE TECHNOLOGY - I JAVA/OOP Wickramanayake HMKSK Department of Electrical & Electronic Engineering Faculty of Engineering University.

Slides:



Advertisements
Similar presentations
A Programmer's Introduction to Java - from a S/370 user (c) IDMS/SQL News
Advertisements

Introduction To Java Objectives For Today â Introduction To Java â The Java Platform & The (JVM) Java Virtual Machine â Core Java (API) Application Programming.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to.
Introduction to Java The objectives of this chapter are: To describe the key aspects of Java To describe the Java software development kit (SDK) To explain.
1 Introduction to Java and Applet Lecture 3 from Chapters 1 and 2 of the complete reference.
Excerpts from Introduction to Java Programming, 4E Author: Y. Daniel Liang (Copyright by Prentice Hall)
Introduction to Java Programming, 4E
Programming Software Applications Week 1 Dr. Xiaohong Gao Trent Park – B107, ext. 2252
1. 2 Chapter 1 Introduction to Computers, Programs, and Java.
01 Introduction to Java Technology. 2 Contents History of Java What is Java? Java Platforms Java Virtual Machine (JVM) Java Development Kit (JDK) Benefits.
Sadegh Aliakbary Sharif University of Technology Fall 2011.
BASIC JAVA PROGRAMMING TUTORIAL. History  James Gosling and Sun Microsystems  Oak  Java, May 20, 1995, Sun World  Hot Java –The first Java-enabled.
Introduction to Java Programming with JBuilder 4
S.W. Ma/CIM/LWL41211/2 Prog. IIA Page 1 HKIVE (Lee Wai Lee Campus) Department of CIM Course : Year 2 Module : Programming IIA Textbook : Introduction.
Java Workshop for Teachers May 6, 2005 A Brief Look at the Java Programming Language.
Sadegh Aliakbary Sharif University of Technology Spring 2011.
Sadegh Aliakbary. Copyright ©2014 JAVACUP.IRJAVACUP.IR All rights reserved. Redistribution of JAVACUP contents is not prohibited if JAVACUP.
Sadegh Aliakbary Sharif University of Technology Fall 2010.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Programming Languages Machine.
Introduction to Java Programming. History F James Gosling and Sun Microsystems F Oak F Java, May 20, 1995, Sun World F HotJava –The first Java-enabled.
1.  At the end of this slide, student can:  Explore tools, features, properties and interface of the Textpad.  Creating a new project.  Open and run.
Sadegh Aliakbary Sharif University of Technology Fall 2012.
1 Part I : Chapter 01 Introduction to Java Programming.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and Server Side Programming Very rich GUI libraries Portability (machine independence) A.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to.
Jaeki Song ISQS6337 JAVA Lecture 03 Introduction to Java -The First Java Application-
Chapter 1: Introduction to Programs, and Java 1. Objectives To review programs (§ ). To understand the relationship between Java and the World Wide.
POS 406 Java Technology And Beginning Java Code
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Java Introduction 1. Introduction to Java Programming2 Computers and Computer Languages Computers are everywhere –how many computers do you own? Computers.
Introduction to Java Programming with Forte Y. Daniel Liang.
Clement Allen, PhD Florida A&M University SUMMER 2006.
Introduction to Java Programming. Introduction Course Objectives Organization of the Book.
Java Programming Lecture 1 Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University
Introduction To JAVA By Ihtesham Ul Haq. Course Objectives Upon completing the course, you will understand Upon completing the course, you will understand.
National Taiwan University Department of Computer Science and Information Engineering National Taiwan University Department of Computer Science and Information.
Mini University July, 2005 A Little Taste of Java (but don’t tell your folks) (they might think there’s caffeine involved)
Java and its Evolution. Contents Java Introduction Java Features How Java Differs from other OO languages Java and the World Wide Web Java Environment.
JAVA Programming “When you are willing to make sacrifices for a great cause, you will never be alone.” Instructor: รัฐภูมิ เถื่อนถนอม
1 Basic Java Constructs and Data Types – Nuts and Bolts Looking into Specific Differences and Enhancements in Java compared to C.
Developed at Sun Microsystems in 1991 James Gosling, initially named “OAK” Formally announced java in 1995 Object oriented and cant write procedural.
Introduction Mehdi Einali Advanced Programming in Java 1.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to.
Introduction to Java Programming. 2 Chapter 1 Introduction to Java and Forte F What Is Java? F Getting Started With Java Programming –Create, Compile.
introductory lecture on java programming
Java Computer Industry Lab. 1 Programming Java Java Basics Incheon Paik.
ITP 109 Week 2 Trina Gregory Introduction to Java.
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 15: Java Basics Fundamentals of Web Programming.
Introduction to JAVA Programming
Introduction to 1. What is Java ? Sun Microsystems Java is a programming language and computing platform first released by Sun Microsystems in The.
Java Programming, 3e Concepts and Techniques Chapter 1 Section 56 – An Introduction to Java.
Introduction to Java Programming, 4E Y. Daniel Liang.
SESSION 1 Introduction in Java. Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
Fundamental of Java Programming (630002) Unit – 1 Introduction to Java.
Introduction to Algorithm. What is Algorithm? an algorithm is any well-defined computational procedure that takes some value, or set of values, as input.
Object Oriented Programming in
JAVA MULTIPLE CHOICE QUESTION.
Chapter 1 Introduction to Computers, Programs, and Java
Chapter No. : 1 Introduction to Java.
Java Course Review.
Chapter 1 Introduction to Computers, Programs, and Java
Advanced Programming Fall 2017.
Units with – James tedder
Units with – James tedder
(Computer fundamental Lab)
Java Evolution Java History. Java Features.
Introducing Java.
Outcome of the Lecture Upon completion of this lecture you will be able to understand Fundamentals and Characteristics of Java Language Basic Terminology.
Presentation transcript:

SOFTWARE TECHNOLOGY - I JAVA/OOP Wickramanayake HMKSK Department of Electrical & Electronic Engineering Faculty of Engineering University of Peradeniya Peradeniya

HISTORY ● Developed by Sun Microsystems in 1991 ● Originally called Oak ● Originally designed for Tvs, VCRs, Toasters, etc ● Mostly based on C & C++ ● Simple and reliable ● Platform-neutral (WORA) James Gosling

JAVA FEATURES ● Compiled and Interpreted ● Platform Independent and Portable ● Object Oriented ● Robust and Secure ● Distributed ● Familiar, Simple and Small ● Multithreaded and Interactive ● High Performance ● Dynamic and Extensible

Places where Java is used ● Screen phones ● Mobile phones ● Desktop computers with Java enabled web browsers ● Desktop computers with Java technology based applications ● Servers with Java applications and Servlets

JDK, SDK & JRE

Java Development Kit Tools ● appletviewer ● javac ● java ● javap ● javah ● javadoc ● jdb

Life of a Java Program

Types of Java Programs ● Stand-alone applications Console based and GUI based applications that run of their own. Require JRE installed in the machine. ● Applets Small programs that run inside a Java enabled web browser (Java plug-in installed).

A Simple Program class MyFirstProg { public static void main(String[] args) { System.out.println("I am Kamal"); } Exercises: Modify the above program to print your name below my name. Replace System.out.println("I am Kamal") by System.out.print("I am Kamal") and see the output. MyFirstProg main(args : String[])

Java Platform

Find the square root of a number /* This program finds the square root of a number. This was written by 22-January 2003Version 0.1 Copyright 2003 */ import java.lang.Math; class SquareRoot { public static void main(String[] args) { double x = 5.0;// Declare, initialize double y;// Just declare y = Math.sqrt(x); System.out.println("Square root of " + x + " is " + y); } Exercise: Draw a class diagram for the SquareRoot class.

Important points... ● Comments /* This is a multiple line comment / // This is an end of line comment /** This is a documentation comment */

Important points... (cont.) ● import statement "import java.lang.Math;" line tells the compiler to use the "Math" class of the "java.lang" package. Examples: import java.net.*;// import all classes of net package import javax.swing.*; // import swing package classes

Two class example class Person { String name;// A string to hold the name int age;// An integer to hold the age void setName(String new_name) { name = new_name; } void setAge(int new_age) { age = new_age; } void showInfo() { System.out.println(name + " is " + age + " years old"); }

Two class example... class PersonTest { public static void main(String[] args) { Person me = new Person(); // Create an object called me me.setName("Kamal"); me.setAge(26); Person you = new Person();// Create an object called you you.setName("Your name here"); you.setAge(85); me.showInfo(); you.showInto(); }// main() ends here }// class PersonTest ends here

Class Diagrams

Java Program Structure ● Documentation Section ● Package Statement ● Import Statements ● Interface Statements ● Class Definitions ● Main Method Class

Java Tokens ● Reserved Keywords class, int, public, static, etc... ● Identifiers MyProg, me, age,... ● Literals 23, "Kamal", false,... ● Operators +, -, *,... ● Separators (, ), {, ",",...

Token Exercise Identify comments, white spaces, different types of tokens in the following program. /* Token Test Program */ import java.util.*; class DateTest { public static void main(String[] args) { Date today = new Date(); // Create a Date object System.out.println(today); }

Command Line Arguments /* WARNING: This program might throw an ArrayIndexOutOfBounds exception */ class MyProgram { public static void main(String[] args) { System.out.println("No of arguments: " + args.length); System.out.println("First argument: " + args[0]); System.out.println("Second argument: " + args[1]); }

Command Line Arguments... class MyProg { public static void main(String[] args) { int i = 0; while(i < args.length) { System.out.printn(args[i]); i = i + 1; } Exercises: Write a program to print integers from 0 to 10 using a while loop. Write a program to print integers from 10 to 0 using a while loop.

Wisdom comes not from extensive reading, but from inward inspection and reflection