Welcome to Java. 2  History of java  Advantages of java  Java first program  Rules to be followed  Data types  Operators  Casting  Control statements.

Slides:



Advertisements
Similar presentations
Designing a Program & the Java Programming Language
Advertisements

CS0007: Introduction to Computer Programming Console Output, Variables, Literals, and Introduction to Type.
 2005 Pearson Education, Inc. All rights reserved Introduction.
Chapter 1: Introduction
Lab#1 (14/3/1431h) Introduction To java programming cs425
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?
C programming Language and Data Structure For DIT Students.
CHAPTER 1: INTORDUCTION TO C LANGUAGE
01 Introduction to Java Technology. 2 Contents History of Java What is Java? Java Platforms Java Virtual Machine (JVM) Java Development Kit (JDK) Benefits.
Introducing Java.
CSC 142 A 1 CSC 142 Introduction to Java [Reading: chapter 0]
+ 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.
Week 4-5 Java Programming. Loops What is a loop? Loop is code that repeats itself a certain number of times There are two types of loops: For loop Used.
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
 Java Programming Environment  Creating Simple Java Application  Lexical Issues  Java Class Library.
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.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
CMSC 202 Exceptions. Aug 7, Error Handling In the ideal world, all errors would occur when your code is compiled. That won’t happen. Errors which.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
Programming With C.
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.
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.
Board Activity Find your seat on the seating chart Login – Remember your login is your first initial your last name and the last three numbers of your.
Week 1 - Friday.  What did we talk about last time?  Our first Java program.
Basics of Java IMPORTANT: Read Chap 1-6 of How to think like a… Lecture 3.
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.
1 Web Based Programming Section 8 James King 12 August 2003.
Introduction To JAVA By Ihtesham Ul Haq. Course Objectives Upon completing the course, you will understand Upon completing the course, you will understand.
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.
We will talking about story of JAVA language. By Kristsada Songpartom.
Mini University July, 2005 A Little Taste of Java (but don’t tell your folks) (they might think there’s caffeine involved)
Object Oriented Programming Examples: C++, Java Advantages: 1. reusibility of code 2. ability to adapt (extend) previously written code.
Copyright © Mohamed Nuzrath Java Programming :: Syllabus & Chapters :: Prepared & Presented By :: Mohamed Nuzrath [ Major In Programming ] NCC Programme.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and web applications Very rich GUI libraries Portability (machine independence) A real Object.
Java Basics 1 Brief History of Java and Overview of Langauge.
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
Today… “Hello World” ritual. Brief History of Java & How Java Works. Introduction to Java class structure. But first, next slide shows Java is No. 1 programming.
Agenda Comments Identifiers Keywords Syntax and Symentics Indentation Variables Datatype Operator.
Packages. The main feature of OOP is its ability to support the reuse of code: –Extending the classes –Extending interfaces The features in basic form.
Java Package Advantage of Java Package
An overview of C Language. Overview of C C language is a general purpose and structured programming language developed by 'Dennis Ritchie' at AT &T's.
Object Oriented Programming Object and Classes Lecture 3 MBY.
ITP 109 Week 2 Trina Gregory Introduction to Java.
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
Garbage Collection It Is A Way To Destroy The Unused Objects. To do so, we were using free() function in C language and delete() in C++. But, in java it.
Mr H Kandjimi 2016/01/03Mr Kandjimi1 Week 3 –Modularity in C++
Java Programming Fifth Edition Chapter 1 Creating Your First Java Classes.
Learning Plan 6 Java Programming Intro to Object Oriented Programming.
1 Lecture 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line of Text 2.3Another Simple C Program: Adding.
 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.
Object Oriented Programming in
Chapter 1 Introduction to Computers, Programs, and Java
Chapter 2 - Introduction to C Programming
Internet and Java Foundations, Programming and Practice
C Language VIVA Questions with Answers
C-language Lecture By B.S.S.Tejesh, S.Neeraja Asst.Prof.
Introduction to C Programming Language
Chapter 2 - Introduction to C Programming
Chapter 1 Introduction to Computers, Programs, and Java
Introduction CSC 111.
Constructors, GUI’s(Using Swing) and ActionListner
(Computer fundamental Lab)
C – Programming Language
CMSC 202 Exceptions.
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:

Welcome to Java

2  History of java  Advantages of java  Java first program  Rules to be followed  Data types  Operators  Casting  Control statements  Taking input from keyboard  Arrays  Strings  String buffer and string builder  Oops concepts  Access specifiers  Constructors  Different types of methods  This Keyword contents

3 Contents continued  Interface and package  Threads  Exception handling  Graphical programming  Awt  Swings  Applet

4 This is java tutorial from Java Bean this is the demo version of first class In this tutorial we are going to learn the basic foundations required to learn java Before getting into java the first question comes to mind is Is java tough ?

5 Definitely not ! If yes then how we understand other languages like English, Hindi although our mother tongue may be different how we learnt those languages We had certain basic foundation through which we Started learning We started with alphabets A B C D grouped these alphabets to form words.we grouped these words to form sentence These sentences are used as communication bridge to talk and understand others talk

6 Similarly we can learn java.here also we have alphabets known as variables, words known as keywords statements known as syntax By using these syntax we can communicate to computer to perform task

7 Before stepping into java,basic knowledge of C& C++ is needed as they are the foundation on which java is been designed If you don’t have no need to worry in this tutorial required knowledge of C & C++ is covered Let us begin Java with C program….hello word to know the meaning of Syntax(So called statements)

8 #include main() { printf("Hello World"); } Simple Hello world Program

9 # means preprocessor directives As a name says which are processed before, The C preprocessor modifies a source file before handing it over to the compilerC preprocessor Or we can say pre written, Include is simple including of pre written function definition is a label where the definition of function are Stored

10 Don’t be confused now we will understand where #include will come into picture In last slide I was talking about function definition Basically there are 2 types of functions 1.Predefined 2.Userdefined Function is defined as set(group) of syntax performing specific task

11 Basically function as two parts Function prototype(head) Function body(defination) add()…………………….function prototype(head) { …………. ………… ………. } Function body

12 function prototype: Says what I am going to do function definition: Says what task I am doing When we consider our above program we have to functions main() printf()

13 #include main()……………………..no semicolon { printf("Hello World"); …….semicolon } What difference you can notice between main and printf When function has no semicolon it is followed by { and ended with } Which means head and body exist

14 Main : is the function where execution starts After main exection goes to printf(); where no defination is found so compiler goes to library search for label inside which it search for printf defination When defination is found it copies the entire code from library to program and execute it

15 add()…………………….function prototype(head) { …………. ………… ………. } Function can only executed if it has both head and body Then in case of printf(); where is the body,if no body how can it run Function body

16 Regular used functions definition are pre written and are stored in library which at the start of the program we are including Since there are lot of predefined functions they categorized by labels In these blocks respective function definitions are stored Similarly the function defined by us are called as user defined function

17 #include main() { printf("Hello World"); } C library Stdio.h Conio.h Math.h definition

18 The reason to start with c program was just to know the meaning Of the words what we use in program, when we know the meaning of the syntax,programs are easy to learn now it’s a time to know how java came into existence and why it has become so important Although we have c and c++,why java came into existance ? Where c and c++ fail……..?

19 C and C++ failed due to platform dependencies Platform is base where we run program, platform is combination of operating System and Processor Win 7 os Win 7 os keyboard I3 process or platform

20 When we write C program in operating system and processor,it can be re runned in only in same operating system and processor For example if I write program in win7 nd p4 processor it can be runned again in the same,if I try to run in different os and processor like win7 and i5,it fails to run Why c and c++ fail to run…?

21 case 1 Win7 P4 Add.c case 1 Win7 P4 Add.c case 2 Win7 I3 Add.c Add.obj Add.exe Compile run Compile run Why it is not running…………?

22 Lets know the reason When we write c program we save with the extension.c Add.c This is source code When we compile c program we get the extension.obj Add.obj This is machine code(object code) This machine code always depends upon processor and operating System

23 case 1 Win7 P4 Add.c case 1 Win7 P4 Add.c Add.obj Add.exe Compile run Let us consider Case 1 Os:-win 7 Process:p4 When we compiles Add.c For adding of two numbers Machine codeformat we get Add A,B

case 2 Win7 I3 Add.c Add.obj Add.exe Compile run When we consider case 2 Os:win7 Process:i3 When we compiles Add.c For adding of two numbers Machine codeformat we get A ADD B

25 Now we try to take code of case 1 after compiling and pate to run in case 2 Case 1 lang:ADD A,B Case 2 lang:A ADD B Case 2 cannot recognize case 1 language hence it cannot run This made c and c++ failure Since all systems cannot have same os and processor it is platform dependent

26 Being a software developer we want our application(program) to be used by all in such a case it should be recognized by all the system This made the invention of java

27 History of java Gosling is founder of Java programming language in 1994 it was named as oak Java In January 1995 it was renamed as java since was already registered Its platform independent pure object oriented if we write once we can run anywhere

28 Import java.io.* public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World"); } Simple java Program

29 Before we enter in depth lets see how it was made platform Independent Saving java program:Example.java After compiling Example.class Class code is not machine code like c,it is called as Byte code

30 Byte code is a intermediate code which is nither source code nor machine code Problem was machine code reason if we convert to Machine code only that machine can understand This code is given to converter (jvm) which converts to machine language depending on machine Hence depending on machines there are flavors of jvm

31 Let us consider example Person A Knows only english Person B Knows english/frenc h Person c Knows only French

32 Similar Thing happens in java This is how java is platform independent jvm

33  Advantages of java  Java first program  Rules to be followed This is it For First class We shall continue next class with below topics