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.

Slides:



Advertisements
Similar presentations
What Is Java? The name Java is a trademark of Sun Microsystems
Advertisements

Portability and Safety Mahdi Milani Fard Dec, 2006 Java.
Introduction To Java Objectives For Today â Introduction To Java â The Java Platform & The (JVM) Java Virtual Machine â Core Java (API) Application Programming.
Lab Information Security Using Java (Review) Lab#0 Omaima Al-Matrafi.
Client Side Programming Using Java Applet Outcomes: You will be expected to know: – Java Applets and HTML file; –bytecode and platform independent programs;
Introduction to Java Kiyeol Ryu Java Programming Language.
Slide 1 of 40. Lecture A The Java Programming Language Invented 1995 by James Gosling at Sun Microsystems. Based on previous languages: C, C++, Objective-C,
Introduction to Java.
Introduction to Java Programming Language Junji Zhi University of Toronto 1.
A Short Introduction to 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.
CMSC 341 Introduction to Java Based on tutorial by Rebecca Hasti at
Programming in Java; Instructor:Moorthy Introduction, Objects, Classes, Libraries1 Programming in Java Introduction.
JAVA v.s. C++ Programming Language Comparison By LI LU SAMMY CHU By LI LU SAMMY CHU.
+ Java vs. Javascript Jessi Style. + Java Compiled Can stand on its own Written once, run anywhere Two-stage debugging Java is an Object Oriented Programming.
Java Security. Topics Intro to the Java Sandbox Language Level Security Run Time Security Evolution of Security Sandbox Models The Security Manager.
About the Java  Java technology is both a programming language and a platform –The Java Programming Language A high-level language that can be characterized.
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
DAT602 Database Application Development Lecture 5 JAVA Review.
Java Introduction Lecture 1. Java Powerful, object-oriented language Free SDK and many resources at
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.
JAVA Java is a programming language and computing platform first released by Sun Microsystems in It was first developed by James Gosling at Sun Microsystems,
CS 11 java track: lecture 1 Administrivia need a CS cluster account cgi-bin/sysadmin/account_request.cgi need to know UNIX
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
Introduction and Features of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++
POS 406 Java Technology And Beginning Java Code
Chapt. 1 Introduction to Core Java. Lecture 1: Overview of Java.
Java means Coffee Java Coffee Beans The name “JAVA” was taken from a cup of coffee.
Basics of Java IMPORTANT: Read Chap 1-6 of How to think like a… Lecture 3.
Java Programming Presented by Daniel Rosenthal Friday, November 30 th, 2007.
Introduction to java Prepared By:-Pragnesh Patel Lect. In Computer Dept. NSIT,Jetalpur 1.
Netprog: Java Intro1 Crash Course in Java. Netprog: Java Intro2 Why Java? Network Programming in Java is very different than in C/C++ –much more language.
 JAVA Compilation and Interpretation  JAVA Platform Independence  Building First JAVA Program  Escapes Sequences  Display text with printf  Data.
Applied Computing Technology Laboratory QuickStart C# Learning to Program in C# Amy Roberge & John Linehan November 7, 2005.
C# Versus Java Author: Eaddy, Marc Source: Software Tools for the Professional Programmer. Dr. Dobb's Journal. Feb2001, Vol. 26 Issue 2, p74 Hong Lu CS699A.
1 Introduction to Java. 2 What is Java? A programming language. A platform –A virtual machine (JVM) definition. –Runtime environments in diverse hardware.
Object Oriented Programming Lecture 3. Introduction  In discussing Java, some items need to be clarified  The Java programming language  The Java virtual.
What Is Java? According to Sun in a white paper: Java: A simple, object-oriented, network-savvy, interpreted, robust, secure, architecture-neutral, portable,
National Taiwan University Department of Computer Science and Information Engineering National Taiwan University Department of Computer Science and Information.
We will talking about story of JAVA language. By Kristsada Songpartom.
Copyright © Mohamed Nuzrath Java Programming :: Syllabus & Chapters :: Prepared & Presented By :: Mohamed Nuzrath [ Major In Programming ] NCC Programme.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Applied Computing Technology Laboratory QuickStart Java Learning to Program in Java Dr. Tom Way October 21, 2005.
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
1. An Introduction A Programming Language A Technology Java Development Kit Java API One Language: Three Editions Standard Edition Enterprise Edition.
Developed at Sun Microsystems in 1991 James Gosling, initially named “OAK” Formally announced java in 1995 Object oriented and cant write procedural.
introductory lecture on java programming
Spring 2009 Programming Fundamentals I Java Programming XuanTung Hoang Lecture No. 8.
Chapter 1 Java Programming Review. Introduction Java is platform-independent, meaning that you can write a program once and run it anywhere. Java programs.
ITP 109 Week 2 Trina Gregory Introduction to Java.
Web Design & Development Lecture 2. Intro to Java.
Features of JAVA PLATFORM INDEPENDENT LANGUAGE JAVA RUNTIME ENVIRONMENT (JRE) JAVA VIRTUAL MACHINE (JVM) JAVA APP BYTE CODE JAVA RUNTIME ENVIRONMENT.
Object Oriented Programming Lecture 2: BallWorld.
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.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Object Oriented Programming in
Java™ 2 Platform Getting Started.
JAVA MULTIPLE CHOICE QUESTION.
Java Basics Introduction to Java.
Chapter No. : 1 Introduction to Java.
Internet and Java Foundations, Programming and Practice
Introduction Enosis Learning.
Introduction to Java Dept. Business Computing University of Winnipeg
Introduction Enosis Learning.
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:

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 for easy Web/Internet applications Widespread acceptance

Java Features (1) Simple  fixes some clumsy features of C++  no pointers  automatic garbage collection  rich pre-defined class library Object oriented  focus on the data (objects) and methods manipulating the data  all functions are associated with objects  almost all datatypes are objects (files, strings, etc.)  potentially better code organization and reuse

Interpreted  java compiler generate byte-codes, not native machine code  the compiled byte-codes are platform-independent  java bytecodes are translated on the fly to machine readable instructions in runtime (Java Virtual Machine) Portable  same application runs on all platforms  the sizes of the primitive data types are always the same  the libraries define portable interfaces Java Features (2)

Java Features (3) Reliable  extensive compile-time and runtime error checking  no pointers but real arrays. Memory corruptions or unauthorized memory accesses are impossible  automatic garbage collection tracks objects usage over time Secure  usage in networked environments requires more security  memory allocation model is a major defense  access restrictions are forced (private, public)

Java Features (4) Multithreaded  multiple concurrent threads of executions can run simultaneously  utilizes a sophisticated set of synchronization primitives (based on monitors and condition variables paradigm) to achieve this Dynamic  java is designed to adapt to evolving environment  libraries can freely add new methods and instance variables without any effect on their clients  interfaces promote flexibility and reusability in code by specifying a set of methods an object can perform, but leaves open how these methods should be implemented  can check the class type in runtime

Java Disadvantages Slower than compiled language such as C  an experiment in 1999 showed that Java was 3 or 4 times slower than C or C++ title of the article: “Comparing Java vs. C/C++ Efficiency Issues to Interpersonal Issues” (Lutz Prechelt)  adequate for all but the most time-intensive programs

Environment Setup Sun Solaris OS JDK 1.4 (latest: J2SE 5.0) You can use the lab at CL112. Please follow the steps:  log into the Unix environment  subscribe to JDK-CURRENT when you log in for the first time (% is a prompt sign) %> subscribe JDK-CURRENT and then log out by clicking on the EXIT button on the control panel

Install Java TM 2 Platform on your machine Can be installed on different platforms:  Unix/Linux  Windows  Mac OS Follow the on-line instructions:

Getting Started: (1) (1) Create the source file:  open a text editor, type in the code which defines a class (HelloWorldApp) and then save it in a file (HelloWorldApp.java)  file and class name are case sensitive and must be matched exactly (except the.java part) Example Code: HelloWorldApp.java /** * The HelloWorldApp class implements an application * that displays "Hello World!" to the standard output */ public class HelloWorldApp { public static void main(String[] args) { // Display "Hello World!" System.out.println("Hello World!"); }  Java is CASE SENSITIVE!

Getting Started: (2) (2) Compile the program:  compile HelloWorldApp.java by using the following command: javac HelloWorldApp.java it generates a file named HelloWorldApp.class  ‘javac’ is not recognized as an internal or external command, operable program or hatch file. javac: Command not found if you see one of these errors, you have two choices: 1) specify the full path in which the javac program locates every time. For example: C:\j2sdk1.4.2_09\bin\javac HelloWorldApp.java 2) set the PATH environment variable

Getting Started: (3) (3) Run the program:  run the code through: java HelloWorldApp  Note that the command is java, not javac, and you refer to HelloWorldApp, not HelloWorldApp.java or HelloWorldApp.class  Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp if you see this error, you may need to set the environment variable CLASSPATH.

Language basics (1) Data types  8 primitive types: boolean, byte, short, int, long, float, double, char  Class types, either provided by Java, or made by programmers String, Integer, Array, Frame, Object, Person, Animal, …  Array types Variables  dataType identifier [ = Expression]:  Example variable declarations and initializations: int x; x=5; boolean b = true; Frame win = new Frame(); String x = “how are you?”; int[] intArray; intArray = new int[2]; intArray[0] = 12; intArray[1] = 6; Person pArray = new Person[10];

Language basics (2) Flow of control  if, if-else, if-else if  switch  for, while, do-while  break  continue

Supplemental reading Getting Started Nuts and bolts of the Java Language Compiling and Running a Simple Program Java1/compile.html