Introduction to Java. What is Java? A computer programming language that can be run as either an application or an applet. –What is the difference? It.

Slides:



Advertisements
Similar presentations
Lab#1 (14/3/1431h) Introduction To java programming cs425
Advertisements

Chapter 1 Object-Oriented System Development
Introduction To System Analysis and Design
Object Oriented System Development with VB .NET
Basic OOP Concepts and Terms
Computers: Tools for an Information Age
Aalborg Media Lab 21-Jun-15 Software Design Lecture 1 “ Introduction to Java and OOP”
Java Programming, 3e Concepts and Techniques Chapter 1 An Introduction to Java and Program Design.
Visual Basic Introduction IDS 306 from Shelly, Cashman & Repede Microsoft Visual Basic 5: Complete Concepts and Techniques.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Chapter 1 Program Design
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Chapter 1 Introduction.
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
INTRODUCTION TO JAVA PROGRAMMING Chapter 1. What is Computer Programming?
1. 2 Chapter 1 Introduction to Computers, Programs, and Java.
Java PAL.  Contains the development kit and the runtime environment ( aka the Java Virtual Machine )  Download Link:
Chapter 1 Introduction to Computers and C++ Programming.
Computer Programming-1 CSC 111 Chapter 1 : Introduction.
Introduction To System Analysis and design
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 Programming, 2E Introductory Concepts and Techniques Chapter 1 An Introduction to Java and Program Design.
Introducing Java.
Java Programming, 2E Introductory Concepts and Techniques Chapter 2 Creating a Java Application and Applet.
Programming Languages: Telling the Computers What to Do Chapter 16.
A First Program Using C#
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
Programming Languages and Paradigms Object-Oriented Programming.
C++ Object Oriented 1. Class and Object The main purpose of C++ programming is to add object orientation to the C programming language and classes are.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 12 Object-Oriented.
GENERAL CONCEPTS OF OOPS INTRODUCTION With rapidly changing world and highly competitive and versatile nature of industry, the operations are becoming.
An Object-Oriented Approach to Programming Logic and Design
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.
Unified Modeling Language, Version 2.0
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
Java Applets. 2 Introduction to Java Applet Programs  Applications are stand alone programs executed with Java interpreter executed with Java interpreter.
Computer Concepts 2014 Chapter 12 Computer Programming.
POS 406 Java Technology And Beginning Java Code
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
Lecture 1 Introduction Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
Java Applets. 2 Introduction to Java Applet Programs Applications are ___________________ programs –executed with Java interpreter Applet is a small program.
Chapter 12 Computer Programming. Chapter Contents Chapter 12: Computer Programming 2  Section A: Programming Basics  Section B: Procedural Programming.
Basic OOP Concepts and Terms. In this class, we will cover: Objects and examples of different object types Classes and how they relate to objects Object.
Object Oriented Programming Examples: C++, Java Advantages: 1. reusibility of code 2. ability to adapt (extend) previously written code.
CSC 131 Fall 2006 Lecture # 6 Object-Oriented Concepts.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Software Engineering and Object-Oriented Design Topics: Solutions Modules Key Programming Issues Development Methods Object-Oriented Principles.
1 Unified Modeling Language, Version 2.0 Chapter 2.
Creating a Java Application and Applet
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.
Chapter 18 Object Database Management Systems. Outline Motivation for object database management Object-oriented principles Architectures for object database.
Lesson 1 1 LESSON 1 l Background information l Introduction to Java Introduction and a Taste of Java.
Introducing Java Chapter 3 Review. Why Program in Java? Java, is an object-oriented programming language. OOP languages evolved out of the need to better.
Program Design. Simple Program Design, Fourth Edition Chapter 1 2 Objectives In this chapter you will be able to: Describe the steps in the program development.
Basic Characteristics of Object-Oriented Systems
PROGRAMMING (1) LECTURE # 1 Programming and Languages: Telling the Computer What to Do.
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
Slide 1 Unified Modeling Language, Version 2.0 Object-Oriented SAD.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Systems Analysis and Design With UML 2
PRINCIPALES OF OBJECT ORIENTED PROGRAMMING
Computer Programming.
Java Applets.
Introduction CSC 111.
Basic OOP Concepts and Terms
Presentation transcript:

Introduction to Java

What is Java? A computer programming language that can be run as either an application or an applet. –What is the difference? It is considered to be a high-level language. Designed in the early 90’s by a team from ??? What is the difference between Java and JavaScript ? How did java get its name? – 1996/jw-10-javaname.fullquote.htmlhttp:// 1996/jw-10-javaname.fullquote.html

Java is… Parsimonious – that is it has a compact set of commands without numerous versions or changes Robust- it supports the development of programs that do not accidentally overwrite data or corrupt data A Strongly typed language – in that its compiler provides extensive checking for potential problems Secure – its programs are easy to protect from viruses. Portability/platform independent – can be used on multiple operating systems

Why Learn Java? Good Paying Careers It’s just a good fun language to know

Java Components Program source Compiler Bytecode Interpreter Java Virtual Machine Java Runtime Environment IDE- Integrated Development Environement

The Java Program Development Life Cycle Analyze the problem Design the program Code the program Test the program Formalize the solution Maintain the program

Algorithms A clear and unambiguous specification of the steps needed to solve a problem. Correct – using a logical constructs and valid data in an organized way so that the steps will be carried out correctly and the program will make suitable responses to invalid data, ie warning messages Efficient – refers to the program’s ability to deliver a result in a short time frame to be useful and using as little memory as possible

Understanding FlowCharts Process Symbol Input/Output Symbol Flowline Symbol Annotation Symbol Decision Symbol Terminal Symbol Connecter Symbol Predefined Process Symbol

Control Structures No matter what procedures (or progression of logical actions) that you wish the computer to perform they can be broken down into these three categories –Sequence Control –Selection Control Case Control –Repetition Control Nested

Java as an Object-Oriented Language Still has many different definitions, but the general concept is to package functions together while not restricting data types. –Ie the open desk example

Object- Speak Nouns –Object – anything real or abstract about which you both store data and operations that manipulate the data –Class- an object or set of objects that share a common structure and common behavior. Subclass superclass

Object Speak Cont Generalization hierarchy –An OO design tool used to show the relationships among classes Data abstraction –Process of creating new high-level data structures based on a defined object through a set of interface operations instead of by directly manipulating the object Instance – unique object or specific occurrence of a class of objects –Ie a two-player button

Verbs Operation – activity that reads or manipulates the data of an object. Message defines the interaction of the object External trigger Process that causes an operation to occur is an event –Event diagram page 1.13

Adjectives Attributes are identifying characteristics of individual objects, such as name, size, or color.

Other terms Encapsulation –Process of hiding the implementation details of an object from its user by combining attributes and methods –Inheritance Concept that programmers can use a class along with functions and data to create a descendent class or subclass Polymorphism –Allows instructions to be given to an object in a generalized rather than specific detailed command, ie where specific actions are different, results are the same

Lets look at an Actual Java Program /* Project 1 Printing on the screen Programmer:Carl Rebman Date:4 March 2003 Program NameCarl */ public class carl { public static void main(String [] args) //method header { System.out.println("Carl's Antiques"); System.out.println("208 Olin Hall"); System.out.println("San Diego, CA 92110"); }

How do you run it? First step is to have the JDK loaded Second step (after program is written) is to compile the program –Go to command prompt –Set prompt to location of JDK compiler –In this case should be path=c:\jdk1.2.2\bin –Next change to the directory your program is in—should be A:\

Running the program cont. Once path has been set and proper directory has been established Run compiler –javac Program_Name.java If successful you’ll get the command prompt again If not, you see a list of errors When there are no errors, run program by typing in –java Progam_Name

So what does the code mean? public class Carl { –A class must be defined in every java program –Public is used as a modifer that describe other classes’s access to this class This becomes more important as your programs get more complex –Basically this line starts your program called Carl, and the brackets contain its guts

public static void main(String [] args) Methods are the groups of statements that are executed by your computer when instructed to do so. The main method actually drives the java applications –It is the first place the Java VM looks when you run your application

Public versus static Public makes this method accessible from all other classes Static ensures there is only one reference to this method Void means that the method does not return any value when completed The Strings[args] means that it is an array list of command-line arguments

Comments Single line—begins with // Multiple line begin with /* and end with */

Moving up to an Applet Again what is an applet?

How to run an Applet Type at the command prompt –appletviewer FILE_NAME.html

Special Code import java.awt.Graphics; –This does actually import a class called Graphics –This is a previously defined class of which you can call Extends java.applet Applet –This increases the import and allows for extending the class You get to reuse the functionality of the class Which means when class A extend class B, class A becomes a superclass, and class B becomes a subclass

Now lets write our first JAVA program Project 1 in book