 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.

Slides:



Advertisements
Similar presentations
Portability and Safety Mahdi Milani Fard Dec, 2006 Java.
Advertisements

Date: Subject:Distributed Data Processing Name:Maria Br ü ckner.
Lab Information Security Using Java (Review) Lab#0 Omaima Al-Matrafi.
CERTIFICATION OBJECTIVES Use Class Members Develop Wrapper Code & Autoboxing Code Determine the Effects of Passing Variables into Methods Recognize when.
 2005 Pearson Education, Inc. All rights reserved Introduction.
Lab#1 (14/3/1431h) Introduction To java programming cs425
Client Side Programming Using Java Applet Outcomes: You will be expected to know: – Java Applets and HTML file; –bytecode and platform independent programs;
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
Java review and more. Class Header  Public class Welcome  Case sensitive  Body of the class must be enclosed by braces.
Chapter 3 - Introduction to Java Applets Outline 3.1Introduction 3.2Thinking About Objects 3.4A Simple Java Applet: Drawing a String 3.5Two More Simple.
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.
1 Course Lectures Available on line:
Java and C++, The Difference An introduction Unit - 00.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
Algorithm Programming Bar-Ilan University תשס"ח by Moshe Fresko.
1 Computer Systems -- Introduction  Chapter 1 focuses on:  the structure of a Java application  basic program elements  preparing and executing a program.
Lecture 2 Object Oriented Programming Basics of Java Language MBY.
Basic Java Programming CSCI 392 Week Two. Stuff that is the same as C++ for loops and while loops for (int i=0; i
OOP (Java): Simple/ OOP (Java) Objectives – –give some simple examples of Java applications and one applet 2. Simple Java Programs Semester.
Jaeki Song ISQS6337 JAVA Lecture 03 Introduction to Java -The First Java Application-
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.
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.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
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.
CHAPTER 3 GC Java Fundamentals. 2 BASICS OF JAVA ENVIRONMENT  The environment  The language  Java applications programming Interface API  Various.
 JAVA Compilation and Interpretation  JAVA Platform Independence  Building First JAVA Program  Escapes Sequences  Display text with printf  Data.
Chapter 1 Section 1.1 Introduction to Java Slides prepared by Rose Williams, Binghamton University Kenrick Mock, University of Alaska Anchorage.
Applied Computing Technology Laboratory QuickStart C# Learning to Program in C# Amy Roberge & John Linehan November 7, 2005.
JAVA PROGRAMMING BASICS CHAPTER 2. History of Java Begin with project Green in 1991 founded by Patrick Noughton, Mike Sheridan and James Gosling who worked.
Page: 1 การโปรแกรมเชิงวัตถุด้วยภาษา JAVA บุรินทร์ รุจจนพันธุ์.. ปรับปรุง 15 มิถุนายน 2552 Keyword & Data Type มหาวิทยาลัยเนชั่น.
Fall 2015CISC124 - Prof. McLeod1 CISC124 Have you filled out the lab section survey? (As of last night 54 left to fill out the survey.) TA names have been.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Copyright Curt Hill Variables What are they? Why do we need them?
Intro to Applets. Applet Applets run within the Web browser environment Applets bring dynamic interaction and live animation to an otherwise static HTML.
1 Basic Java Constructs and Data Types – Nuts and Bolts Looking into Specific Differences and Enhancements in Java compared to C.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
Developed at Sun Microsystems in 1991 James Gosling, initially named “OAK” Formally announced java in 1995 Object oriented and cant write procedural.
By Mr. Muhammad Pervez Akhtar
Creating a Java Application and Applet
Classes, Interfaces and Packages
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.
COP 2551 Introduction to Object Oriented Programming with Java Topics –Introduction to the Java language –Code Commenting –Java Program Structure –Identifiers.
Java Computer Industry Lab. 1 Programming Java Java Basics Incheon Paik.
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.
Object Oriented Programming in
JAVA MULTIPLE CHOICE QUESTION.
Intro to ETEC Java.
Chapter 4 Assignment Statement
GC101 Introduction to computer and program
Chapter No. : 1 Introduction to Java.
Yanal Alahmad Java Workshop Yanal Alahmad
Java Programming Language
Internet and Java Foundations, Programming and Practice
Chapter 3 Assignment Statement
I/O Basics.
Introduction to Java.
Starting JavaProgramming
null, true, and false are also reserved.
Java Programming Language
An Introduction to Java – Part I, language basics
The Building Blocks Classes: Java class library, over 1,800 classes:
From C++ to Java Java history: Oak, toaster-ovens, internet language, panacea What it is O-O language, not a hybrid (cf. C++) compiled to byte-code, executed.
(Computer fundamental Lab)
Review of Java Fundamentals
Presentation transcript:

 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling

There are two types of java programming. They are  Application programming  Applet programming

 Application programming was based on CUI (character user interface)  It has a more security privilege.

 Applet programming is based on GUI ( graphical user interface )  It is more secure.  It is executed in a java-enabled browser ( such as Internet Explorer, Applet browser)  It can only runs on Applet viewer or any other browser.

Class Example { public static void main(String arg[]) { System.out.println( “This is a simple java program”); } }

 Java compiler compiles Java code to an intermediate byte code that is understood by the Java Environment.  JVM – Java Virtual Machine  JVM is an Interpreter.  JRE – Java Runtime Environment

 Other than data types such as int, float, etc.  There are two other data types such as byte and Boolean.  Java obeys Unicode ( 16 bit character)  Java provides 2 bytes for char & 4 bytes for int.

 Similar to C++, java also consists of compound statements such as if………else, while statement etc.  It also consists of switch cases, looping statements etc.  But It does not support “ go to “ statement.

 Java does not support multiple inheritance.  All classes in java are derived from object class.  To inherit from a class, we use the extends Keywords.  The base class is known as Super class in Java.  The derived class is known as Subclass in java.

 Array is a collection of data of a similar type in a memory location.  Syntax: 1, [ ] ; (or) 2, [ ];

A java program can be executed in command prompt by using following steps: 1, Save  welcome.java 2, At command prompt, javac welcome.java for compiling. 3, At command prompt, java welcome to run the program

Steps to create a new project: * file  new project * in the new project window, java  java application  next * in the New java application window, project name : ‘enter the name ‘  next * project name  source package  default package (right click)  new  java class. * in the new class window, class name : ‘enter the name ‘  finish.

In a java program to get inputs at runtime, the following command can be used. 1. BufferReader d = new BufferReader( new InputStreamReader( System.in)); 2. DataInputStream d = new DataInputStream( Sysem.in); for assigning value, a = Integer.parseInt( d.readline( ) );

TThere are several packages in java. IIt is known as a collection of related class into a single unit. WWe can also create our own packages.

 A package can be declared using the following syntax: package package_name;

 Packages can be imported by the following Syntax: 1. import.*; 2. import..*;

 Java. Lang package is an important package which is automatically imported in the java program.  It provides classes according to primitive type (wrapper class)  Some of the wrapper classes are Integer class, Double class  Object class is the super class of all classes in Lang package.

OBJECT CLASS NUMERICA L CLASS INTEGER CLASS LONG CLASS FLOAT CLASS DOUBLE CLASS STRING CLASS

 Java contains function overloading but it does not contain operator overloading.  Java also does not contain pointer, destructors, go to statement.

 Similar to oops, java also contains constant data member and member functions.  Syntax: final datatype constant_identifier = assigned value;  Eg: final int a = 10;

 In java several keywords are used.  Some of them are true, false, null – they are reserved words.

 Converting one data type variable into another data type is called type casting.  Syntax: variable_dt = (datatype) variable;  Eg: int a; byte b; b=(byte) a;

 System class is an important class in the java.  It contains two streams namely input stream and output streams  The object of the input stream is ‘in’  The object of the output stream is ‘out’

 All exceptions in the java programming are the objects of the classes in it.  It is dependent on throwable class such as error and exception.  It is similar to exception handling in C++.  A ‘finally’ block will be executed whether the exception is thrown or not  It appears at the end of the try block

 It is just like a class. It has methods and data items.  It is declared with a keyword “interface”  All the methods of interface are default abstract method.

 We can’t inherit an interface into a class but we can implement into a class using “implements” keyword  While implementing, we must define all the abstract methods of the interface into that class.  We can implement more than one class into a single class ( instead of multiple inheritance)

 Abstract methods have only the declaration. It should be declared/defined in the inherited classes  We cannot create objects for the abstract class but we can create a reference variable.

 Applet does not contain main but contain class which contains following functions.  public void init( );  public void start( );  public void paint( graphics g);  public void stop( );  public void destroy( );

 Called when applet is first loaded to the browser  It is not called each time the applet is executed.

 Called immediately after init( ) initialized.  It is revoked each time user returns to page after having left it.  It is used to start animation threads

 It is called by the browser after init and start  It will revoked whenever the browser redraws the screen ( typically when part of the screen has been obscured and then re-exposed )  This method is used where user level drawing is placed

IIt is called when the user leaves the page IIt is used to stop animation threads

 Import java. Applet.*;  Import java.awt.*; where awt  abstracted window tool kit