INTRODUCTION TO JAVA PROGRAMMING Chapter 1. What is Computer Programming?

Slides:



Advertisements
Similar presentations
Introduction to classes Sangeetha Parthasarathy 06/11/2001.
Advertisements

CS0007: Introduction to Computer Programming Console Output, Variables, Literals, and Introduction to Type.
Chapter 1: Introduction
Object Oriented System Development with VB .NET
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
WEL COME PRAVEEN M JIGAJINNI PGT (Computer Science) MCA, MSc[IT], MTech[IT],MPhil (Comp.Sci), PGDCA, ADCA, Dc. Sc. & Engg.
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
C++ fundamentals.
CH1 – A 1 st Program Using C#. Program Set of instructions which tell a computer what to do. Machine Language Basic language computers use to control.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
+ 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.
A First Program Using C#
Hello AP Computer Science!. What are some of the things that you have used computers for?
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
Programming Languages and Paradigms Object-Oriented Programming.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
Microsoft Visual Basic 2005: Reloaded Second Edition
Introduction to Object-oriented programming and software development Lecture 1.
GENERAL CONCEPTS OF OOPS INTRODUCTION With rapidly changing world and highly competitive and versatile nature of industry, the operations are becoming.
CSM-Java Programming-I Spring,2005 Objects and Classes Overview Lesson - 1.
An Object-Oriented Approach to Programming Logic and Design
Chapter 1: A First Program Using C#. Programming Computer program – A set of instructions that tells a computer what to do – Also called software Software.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
CSCI-383 Object-Oriented Programming & Design Lecture 13.
CS200 Algorithms and Data StructuresColorado State University Part 4. Advanced Java Topics Instructor: Sangmi Pallickara
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.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
 Programming Language  Object Oriented Programming  JAVA – An Introduction  JAVA Milestones  JAVA Features.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
1 Programming Paradigms Object Orientated Programming Paradigm (OOP)
Summing Up Object Oriented Design. Four Major Components: Abstraction modeling real-life entities by essential information only Encapsulation clustering.
Programming Paradigms Lecturer Hamza Azeem. What is PP ? Revision of Programming concepts learned in CPLB Learning how to perform “Object-Oriented Programming”
1.
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 5 Creating Classes.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 26 - Java Object-Based Programming Outline 26.1Introduction.
Introduction to Java Chapter 7 - Classes & Object-oriented Programming1 Chapter 7 Classes and Object-Oriented Programming.
نظام المحاضرات الالكترونينظام المحاضرات الالكتروني Introduction to Object Oriented Programming (OOP) Object Oriented programming is method of programming.
Chapter 5 Classes and Methods II Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
Java Programming, Second Edition Chapter Twelve Advanced Inheritance Concepts.
Chapter 11: Advanced Inheritance Concepts. Objectives Create and use abstract classes Use dynamic method binding Create arrays of subclass objects Use.
Lecture1 Instructor: Amal Hussain ALshardy. Introduce students to the basics of writing software programs including variables, types, arrays, control.
By : Robert Apeldorn. What is OOP?  Object-oriented programming is a programming paradigm that uses “objects” to design applications and computer programs.
Java Programming, Second Edition Chapter Three Using Methods, Classes, and Objects.
Author: DoanNX Time: 45’.  OOP concepts  OOP in Java.
OOPS CONCEPT.  OOPS  Benefits of OOPs  OOPs Principles  Class  Object Objectives.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
 Description of Inheritance  Base Class Object  Subclass, Subtype, and Substitutability  Forms of Inheritance  Modifiers and Inheritance  The Benefits.
Creating Java Applications (Software Development Life Cycle) 1. specify the problem requirements - clarify 2. analyze the problem - Input? Processes? Output.
Basic Characteristics of Object-Oriented Systems
COMPUTER SCIENCE & TECHNOLOGY DEGREE PROGRAMME FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UVA WELLASSA ‏ Properties of Object Oriented Programming.
SUMMARY OF CHAPTER 2: JAVA FUNDAMENTS STARTING OUT WITH JAVA: OBJECTS Parts of a Java Program.
Java Programming Fifth Edition Chapter 1 Creating Your First Java Classes.
Introduction to Object-oriented Programming
Programming Logic and Design Seventh Edition
Done By: Ashlee Lizarraga Ricky Usher Jacinto Roches Eli Gomez
Chapter 3: Using Methods, Classes, and Objects
About the Presentations
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING (OOP) & CONCEPTS
Corresponds with Chapter 7
Group Status Project Status.
Fundamentals of Programming
COP 3330 Object-oriented Programming in C++
Object-Oriented Programming
2.1 Introduction to Object-Oriented Programming
Presentation transcript:

INTRODUCTION TO JAVA PROGRAMMING Chapter 1

What is Computer Programming?

Computer Programming  is the process of designing, writing, testing, debugging, and maintaining the source code of computer programs.  This source code is written in one or more programming languages.

Computer Programming  The purpose of programming is to create a set of instructions that computers use to perform specific operations or to exhibit desired behaviors.  The process of writing source code often requires expertise in many different subjects, including knowledge of the application domain, specialized algorithms and formal logic.

What is Programming Language?

Programming Language  is an artificial language designed to communicate instructions to a machine, particularly a computer.  can be used to create programs that control the behavior of a machine and/or to express algorithms precisely.

Examples of Programming Languages:  Delphi  C  C++  JAVA  Visual Basic etc.

What is Object- Oriented Programming Language?

Object-Oriented Programming Language  Is an extension of procedural programming.  It involves creating program components as objects that are similar to concrete objects in the real world that are manipulated to achieve a desired result.

Object-Oriented Programming Language  When writing object-oriented programs, it involves both creating objects and creating applications that use those objects.

Object-Oriented Programming Language  With this approach, data and the program(or procedure) can be packaged into a single unit called object.  Object- is an item that can contain both data, which are known as attributes or variables, and procedures, which contain activities that read or manipulate the data.

Object-Oriented Programming Language  Is a conceptual approach to designing programs.  Languages like C++ and JAVA have intrinsic features which apply this approach.

Principle of OOP  ENCAPSULATION  INHERITANCE  POLYMORPHISM

Encapsulation  Is a mechanism that binds together attributes and methods into a single object, and keeps both safe from interference or misuse, that is, the details of the object are encapsulated or hidden, from the user.

Encapsulation  It hides the details of the object, it sometimes called information hiding.

Inheritance  An object may be part of a large category of objects called class. Every object in a class shares similar methods and attributes as the original object. Each class can have one or more lower levels called subclasses.

Inheritance  Low levels inheriting methods and attributes of higher levels.  The higher-level class is called a superclass. Each subclass inherits the methods and attributes of the object in its superclass.

Polymorphism  Is a feature that allows one interface to be used for a general class of action, that is, the ability of an object to take many forms or identities.

Benefits of OOP  The ability to reuse the defined objects and modify existing objects.  Saves programming time  Adaptability- it is able to fit in different environment.  Reliability- it is able to operate correctly under all conditions

JAVA PROGRAMMING LANGUAGE

 originally developed by James Gosling at Sun Microsystems (which has since merged into Oracle Corporation) and released in 1995 as a core component of Sun Microsystems' Java platform.

JAVA PROGRAMMING LANGUAGE  Java was originally designed for interactive television, but it was too advanced for the digital cable television industry at the time.

JAVA PROGRAMMING LANGUAGE  The language was initially called Oak after an oak tree that stood outside Gosling's office; it went by the name Green later, and was later renamed Java, from Java coffee, said to be consumed in large quantities by the language's creators.OakoakJava coffee

Structure of a JAVA Program //import packages public class classname { //instance variables access specifier data type variablename1; access specifier data type variablename2; ………… //methods access specifier data type methodname1(parameter list) {//function body1 } access specifier data type methodname2(parameter list) {//function body 2 } …… }

The following is an example of a basic JAVA Application: public class First { public static void main(String[]args) { //this function outputs Hello World System.out.println(“Hello World”) }

Explanation:  Line 1: The keyword class defines a new class and First is the name of the class. public class First  Line 3: It defines a method called main().  public- this keyword is an access modifier, which allows the main() method to be accessed by codes outside this class. public static void main(String[]args)

Explanation:  static- This keyword allows the main() method to be access directly, without needing to create a particular instance of the class. This is necessary since the main() is called by the Java interpreter before any objects are made. public static void main(String[]args)

Explanation:  void- this keyword tells the compiler that the main() method does not return any value when it is called. The main() method produce outputs that does not send any value back to any other method that might use it. public static void main(String[]args)

Explanation:  String[]args- This represents an argument passed to the main() method. String- represents a Java class that can be used to represent character strings. Identifier args- is used to hold any Strings that might be sent to the main() method. The identifier need not be named args– it could be any legal Java identifier– but the name args is traditional.

Explanation:  Line 5: The ‘//’ double slash signs signals comment.  Line 6: This statement displays the string “Hello World” and position the cursor on the next line and stands ready for additional output.  System- a predefined class that provides access to the system  out- one of the System objects which represents the screen  println()- a method that displays the string which is passed to it on the screen.

Explanation:  Dots(periods) in the statement are used to separate the names of the class, object and the method  The entire class definition, including all its members, will be placed between’ { ‘ and ‘ } ‘. The use of ‘ { ‘ and ‘ } ‘ (curly parenthesis) can be used to separate program blocks.

Access Specifier  defines the circumstances under which a class or class member in programs can be accessed.  Public- can be accessed by any class  Private- can only be accessed by members of its own class  Default- similar to the public access level, where it is visible to all classes in the same package  Protected- can be access by all subclasses of this class in any package

PublicProtectedDefaultPrivate Same classYes Subclass in the same package Yes No Non subclass in the same package Yes No Subclass in a different package Yes No Non subclass in a different package YesNo