SESSION 1 Introduction in Java. Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments.

Slides:



Advertisements
Similar presentations
1 Copyright © 2005, Oracle. All rights reserved. Introducing the Java and Oracle Platforms.
Advertisements

Lab Information Security Using Java (Review) Lab#0 Omaima Al-Matrafi.
 2005 Pearson Education, Inc. All rights reserved Introduction.
1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
Object Oriented Programming in JAVA
Lab#1 (14/3/1431h) Introduction To java programming cs425
Liang, Introduction to Java Programming, Sixth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to.
Introduction to Java Kiyeol Ryu Java Programming Language.
Introduction to Java Programming, 4E
1 Key Concepts:  Why C?  Life Cycle Of a C program,  What is a computer program?  A program statement?  Basic parts of a C program,  Printf() function?
Unit2: Object-oriented programming Getting started with Java Jin Sa.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the structure of a C-language program. ❏ To write your first C.
Lecture 1: Overview of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++ Designed.
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.
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.
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
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.
INTRODUCTION TO JAVA CHAPTER 1 1. WHAT IS JAVA ? Java is a programming language and computing platform first released by Sun Microsystems in The.
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 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-
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
Intro and Review Welcome to Java. Introduction Java application programming Use tools from the JDK to compile and run programs. Videos at
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Java means Coffee Java Coffee Beans The name “JAVA” was taken from a cup of coffee.
Introduction to Java Programming with Forte Y. Daniel Liang.
 JAVA Compilation and Interpretation  JAVA Platform Independence  Building First JAVA Program  Escapes Sequences  Display text with printf  Data.
Object Oriented Programming Lecture 3. Introduction  In discussing Java, some items need to be clarified  The Java programming language  The Java virtual.
Using Data Within a Program Chapter 2.  Classes  Methods  Statements  Modifiers  Identifiers.
 Pearson Education, Inc. All rights reserved Introduction to Java Applications.
Session 1 Introduction to Java. Objectives Java Simplified / Session 1 / 2 of 32 Explain the history of Java Explain Java in brief List the types of Java.
An Introduction to Java – Part 1 Dylan Boltz. What is Java?  An object-oriented programming language  Developed and released by Sun in 1995  Designed.
National Taiwan University Department of Computer Science and Information Engineering National Taiwan University Department of Computer Science and Information.
SOFTWARE TECHNOLOGY - I JAVA/OOP Wickramanayake HMKSK Department of Electrical & Electronic Engineering Faculty of Engineering University.
JAVA Programming “When you are willing to make sacrifices for a great cause, you will never be alone.” Instructor: รัฐภูมิ เถื่อนถนอม
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
Developed at Sun Microsystems in 1991 James Gosling, initially named “OAK” Formally announced java in 1995 Object oriented and cant write procedural.
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
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
Spring 2009 Programming Fundamentals I Java Programming XuanTung Hoang Lecture No. 8.
Java Computer Industry Lab. 1 Programming Java Java Basics Incheon Paik.
Review A program is… a set of instructions that tell a computer what to do. Programs can also be called… software. Hardware refers to… the physical components.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to Computers,
Features of JAVA PLATFORM INDEPENDENT LANGUAGE JAVA RUNTIME ENVIRONMENT (JRE) JAVA VIRTUAL MACHINE (JVM) JAVA APP BYTE CODE JAVA RUNTIME ENVIRONMENT.
Introduction to JAVA Programming
Introduction to Java Programming, 4E Y. Daniel Liang.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
Object Oriented Programming in
1. Introduction To JAVA.
JAVA MULTIPLE CHOICE QUESTION.
Chapter No. : 1 Introduction to Java.
Yanal Alahmad Java Workshop Yanal Alahmad
Getting Started ARCS Lab..
Advanced Programming Fall 2017.
An Introduction to Java – Part I, language basics
Chapter 1 Introduction to Computers, Programs, and Java
Units with – James tedder
Units with – James tedder
(Computer fundamental Lab)
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:

SESSION 1 Introduction in Java

Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments Variables and Datatypes Overview Netbeans

Objects Object is the representation of real world entities Example: persons, tables, computers… Each object has Characteristics to describe properties Actions Example, properties and actions of car

Software objects Similar to objects in the real world Software object also has: The sate of object is called attributes or fields The action of object is called behavior or method

Class Class is the template that defines the outline of states and behaviors for all objects belonging to that class Class is the concept model of entities Object is the instance of class Fields and method are the members of class

Introduction to Java Java being secure, portable, and platform independent was found to be capable of addressing large scale problems across the Internet Introduced in 1995 by Sun Microsystems Its objective was to develop a software for embedding in consumer electronic devices. Initially called ‘Oak’ Internet users had problems of portability and platform independence

Features of Java Object – oriented Compiled and interpreted Portable - Platform independent Robust Secure Distributed Multithread

Java technologies J2SE – java standar edition Console application Desktop application J2EE – java enterprise edition Servlet, JSP EJB, JMS Struts … J2ME – java micro edition

Java platform Platform is a hardware or software in which a program runs Ex: Windows, Linux, Solaris Java platform consists 2 essential components

Java Virtual Machine (JVM) JVM is the heart of Java JVM has an interpreter component that enables communication between Java byte code and a computer’s operating system Java code can run on any platform by using JVM JVM normally reads and executes Java statements one at a time Functionalities of JVM Loading.class file Managing the memory Performing the garbage collection

Java Development Kit (JDK) A set of command line tools Three major releases are: Java 1.0 – first release, 1996 Java 1.1 – 1997 release Java Java – 2002 Java 1.5 – 2004 Java 1.6 Contains the software and tools needed to compile, debug and execute applets and applications

Tools under JDK javac: compiler used to compile Java source code Syntax: javac [option] source Source files ends with an extension of.java Ex: javac Test.java java: interpreter used to execute Java byte codes java [option] classname [arguments] Ex: java Test javadoc javap

Configure JDK Path: specifies the location of javac, java, … tools Classpath: an environment variable that specifies thee location of class file and libraries needed for the Java compiler to compile the applications

A Sample Java program // This is a simple program called First.java class First { public static void main (String [] args) { System.out.println ("My first program in Java "); } Comments: //comment for one line /* …comment for multi lines */ /** …comments are generated in java document */

Compiling and executing the Java program The java compiler creates a file called 'First.class' that contains the byte codes

Compiling and executing the Java program (cont)

Variables Location in the merory where a value is stored and can be retrieved later Basic units of storeage in Java program Variables must be declared beforing using Declaring variable datatype variable; Example: int a;

Example class DynVar { public static void main(String [] args) { double len = 5.0, wide = 7.0; double num = Math.sqrt(len * len + wide * wide); System.out.println("Value of num after dynamic initialization is " + num); }

Name convention of variable Must begin a letter, $ or _ Must not be a keyword or reserved word Case-sensitive Not including white space If name consists of more than word, the first letter of each subsequent word should be capitalized Example: customerName my_phone $product_Code

Literals Fixed values Represented directly in code without requiring computeation Integer literals – represent an int value Decimal values – base 10 Octal value – base 8 Hexadecimal value – base 16 Float literal – represent decimal values with a fractional component. It has parts: Whole number: 0, 1, 2, …, 9 Decimal point: 4.03 Exponent: E or e, e+10, E-02 Suffix: D, d, f, F

Literals (cont…) Boolean literal – represent true or false Character literal – represent character is enclosed in single quotes Ex: ‘a’, ‘!’ Null literal String literal – represent sequence of characters enclosed in double quotes Ex: “hello”, “12a”

Data Types byte char boolean short int long float double Array Class Interface

Scanner Locate in java.util package Allows the user to read many types of data Syntax: import java.util.Scanner; Scanner s = new Scanner(System.in);