Java Programming, Second Edition Chapter One Creating Your First Java Program.

Slides:



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

In Review JAVA C++ GUIs - Windows Webopedia.com.
CS0007: Introduction to Computer Programming Console Output, Variables, Literals, and Introduction to Type.
CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib.
The Web Warrior Guide to Web Design Technologies
Dale Roberts Introduction to Java - First Program Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and.
MC697 Object-Oriented Programming Using Java. In this class, we will cover: How the class will be structured Difference between object-oriented programming.
 2005 Pearson Education, Inc. All rights reserved Introduction.
Object Oriented Programming in JAVA
Chapter 1: Introduction
Slides prepared by Rose Williams, Binghamton University Chapter 1 Getting Started 1.1 Introduction to Java.
CHAPTER 1 INTRODUCTION GOALS  To understand the activity of programming  To learn about the architecture of computers  To learn about machine code and.
Computer Concepts 5th Edition Parsons/Oja Page 546 CHAPTER 11 Software Engineering Section A PARSONS/OJA Computer Programming.
Computers: Tools for an Information Age
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
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 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?
CSE 1301 J Lecture 2 Intro to Java Programming Richard Gesick.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
Getting Started with Java
1 Building Java Programs Chapter 1: Introduction to Java Programming These lecture notes are copyright (C) Marty Stepp and Stuart Reges, They may.
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 Programming, 2E Introductory Concepts and Techniques Chapter 2 Creating a Java Application and Applet.
CSC 111 Java Programming I. Java Programming: From Problem Analysis to Program Design, Second Edition  Instructor – Salwa Hamad Al-Jasser  Office.
Programming Languages: Telling the Computers What to Do Chapter 16.
A First Program Using C#
IT258 Foundation of Programming Using Java
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
Microsoft Visual Basic 2005: Reloaded Second Edition
Object Oriented Systems Lecture 01 First Java Programming Jaeki Song.
Chapter 1: Creating Java Programs
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.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Programming Languages Machine.
BIT 1003 – Presentation 7. Contents GENERATIONS OF LANGUAGES COMPILERS AND INTERPRETERS VIRTUAL MACHINES OBJECT-ORIENTED PROGRAMMING SCRIPTING LANGUAGES.
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.
Chapter 1 What is Programming? Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
Computer Programming A program is a set of instructions a computer follows in order to perform a task. solve a problem Collectively, these instructions.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
1 Computer Systems -- Introduction  Chapter 1 focuses on:  the structure of a Java application  basic program elements  preparing and executing a program.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and Server Side Programming Very rich GUI libraries Portability (machine independence) A.
Jaeki Song ISQS6337 JAVA Lecture 03 Introduction to Java -The First Java Application-
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
Intro and Review Welcome to Java. Introduction Java application programming Use tools from the JDK to compile and run programs. Videos at
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
CHAPTER 3 GC Java Fundamentals. 2 BASICS OF JAVA ENVIRONMENT  The environment  The language  Java applications programming Interface API  Various.
Chapter 1 Section 1.1 Introduction to Java Slides prepared by Rose Williams, Binghamton University Kenrick Mock, University of Alaska Anchorage.
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
1 CSE1340 Class 4. 2 Objectives Write a simple computer program in Java Use Swing components to build the GUI Use proper naming conventions for classes.
© 2004 Pearson Addison-Wesley. All rights reserved ComS 207: Programming I Instructor: Alexander Stoytchev
J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Second Edition Second Edition D.S. Malik D.S. Malik.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and web applications Very rich GUI libraries Portability (machine independence) A real Object.
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
Java Software Solutions Lewis and Loftus Chapter 2 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Software Concepts -- Introduction.
Creating a Java Application and Applet
©2016 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved. CSC 110 – INTRO TO COMPUTING - PROGRAMMING Overview of Programming.
Lecture1 Instructor: Amal Hussain ALshardy. Introduce students to the basics of writing software programs including variables, types, arrays, control.
Programming Languages Concepts Chapter 1: Programming Languages Concepts Lecture # 4.
Java Programming Fifth Edition Chapter 1 Creating Your First Java Classes.
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.
GC101 Introduction to computer and program
Key Ideas from day 1 slides
Java programming lecture one
Introduction CSC 111.
Chap 4. Programming Fundamentals
Computer Programming-1 CSC 111
Instructor: Alexander Stoytchev
Presentation transcript:

Java Programming, Second Edition Chapter One Creating Your First Java Program

In this chapter, you will:  Learn about programming  Understand object-oriented programming concepts  Learn about the Java programming language  Start a Java program  Add comments to a Java program  Run a Java program  Modify a Java program

Learning about programming  Program - A set of instructions that you write to tell a computer what to do  Machine language - The language a machine works in  High-level programming languages - Languages that allow programmers to use terms such as “read,” “write,” and “add”  Syntax-The rules of the language  Logic – correct statements and order to produce outcome desired

Converting high level-language code  Compiler - All instructions converted at once from high-level language to machine language; new program is then run  C/C++, COBOL, FORTRAN, etc. compile  Interpreter - High-level language code is read and converted at run time line by line  Basic, Perl, PHP, Python are interpreted  Java is compiled, then interpreted

Procedural Programming  Procedural programming – step-by-step approach to problem-solving  Variables – hold values  Operations – read, write, math  Procedures are groups of operations  Calls – when a program jumps to a procedure

OOP Concepts  OOP is a different approach to problem- solving; conceptualizing objects instead of steps  Create objects, then applications that use these objects  Similar to concrete objects in the real world  Objects have states and methods  States are also called attributes  Methods are functions – blocks of code

OOP Concepts cont.  Class – a group of objects with common properties  Instance – single existing object of a class  Inheritance – objects inherit attributes from the parent class  Encapsulation – “data hiding”; programmer only needs to know the interface for a class, not its internal workings

Java Programming Language  Developed by Sun Microsystems as an object-oriented language that is both used for general-purpose business programs and for interactive World Wide Web-based Internet programs

Architecturally Neutral  The Java programming language can be used to write a program that will run on any platform or operating system using the JVM (Java Virtual Machine).  Java runs on a hypothetical computer known as the Java virtual machine (JVM)  When your source code program is compiled into byte code, an interpreter within the JVM interprets the byte code and interfaces with the operating system to produce the program results

Java Program Types  Java applets – programs embedded in a Web page  Java applications – stand-alone programs  Applications can be  Console-based: DOS-style input/output from keyboard to screen, or  Windowed – GUI interface

Starting a Java Program  Literal string- A series of characters that will appear exactly as entered  Arguments- Information that a method requires to perform its task System.out.println(“First Java Program”);

Java class name requirements  Must begin with a letter of the alphabet, [or an underscore, or a dollar sign]  Can only contain letters, digits, underscores, or dollar signs  Cannot be a Java reserved keyword  Cannot be one of the following values: true, false, or null

Printing a String  Access Modifier- Defines the circumstances under which a class can be accessed  static- Ensures that the method is accessible even though no objects of the class exist  void- The method does not return any value when it is called

Program Comments  Program Comments- Nonexecuting statements that you add to a program for the purpose of documentation  Line comments- //  Block comments - /* */  javadoc comments - /** */

Running a Java Program 1. You must compile the program you wrote (called the source code) into bytecode. 2. You must use the Java interpreter to translate the bytecode into executable statements.

Running a Java Program  The commands for compiling and executing are:  Compiling a program (from the DOS prompt)  javac Hello2.java  Executing a program  java Hello2

Modifying a Program  To produce the new output:  Modify the text file that contains the existing program  Change the class name  Change the literal string that currently prints and then add an additional text string

Errors  Run-time or Logic Errors- Occur when the syntax of the program is correct and the program is compiled, but produces incorrect results  Syntax Errors- Programming errors that occur when you introduce typing errors into your program

Documentation  has full Java documentation of every class, method, and attribute in the Java libraries, plus tutorials and more