CS-0401 INTERMEDIATE PROGRAMMING USING JAVA

Slides:



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

Chapter 1: Computer Systems
1 Java Programming Basics SE-1011 Dr. Mark L. Hornick.
IntroductionIntroduction  Computer program: an ordered sequence of statements whose objective is to accomplish a task.  Programming: process of planning.
The Java Programming Language
Outline Java program structure Basic program elements
Chapter 1 Introduction. © 2004 Pearson Addison-Wesley. All rights reserved1-2 Outline Computer Processing Hardware Components Networks The Java Programming.
COMP 14: Intro. to Intro. to Programming May 23, 2000 Nick Vallidis.
Chapter 1 Introduction.
Copyright 2013 by Pearson Education Building Java Programs Chapter 1 Lecture 1-1: Introduction; Basic Java Programs reading:
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
Copyright 2008 by Pearson Education Building Java Programs Chapter 1 Lecture 1-1: Introduction; Basic Java Programs reading: self-check: #1-14.
Java Software Solutions Lewis and Loftus Chapter 2 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Software Concepts -- Introduction.
Java: Chapter 1 Computer Systems Computer Programming II Aug
CS-0401 INTERMEDIATE PROGRAMMING USING JAVA Prof. Dr. Paulo Brasko Ferreira Fall 2014.
Prepared by Uzma Hashmi Instructor Information Uzma Hashmi Office: B# 7/ R# address: Group Addresses Post message:
Chapter 1 Programming Languages. Application Development: Top 10 Programming Languages to Keep You Employed 1. Java 2. C# 3. C++ 4. JavaScript 5. Visual.
Java 程序设计 Java Programming Fall, Contents for Today Java Program Structure  How to Compile a Java Program  How to Run a Java Program Environment.
1 Identifiers  Identifiers are the words a programmer uses in a program  An identifier can be made up of letters, digits, the underscore character (
© 2006 Pearson Education Computer Systems Presentation slides for Java Software Solutions for AP* Computer Science A 2nd Edition.
Java: Chapter 1 Computer Systems Computer Programming II.
Java Language and SW Dev’t
1 Computer Systems -- Introduction  Chapter 1 focuses on:  the structure of a Java application  basic program elements  preparing and executing a program.
CSCE 2013L: Lab 1 Overview  Java Basics The JVM Anatomy of a Java Program  Object-Oriented Programming Overview  Example: Payroll.java JDK Tools and.
Introduction to Programming David Goldschmidt, Ph.D. Computer Science The College of Saint Rose Java Fundamentals (Comments, Variables, etc.)
The Java Programming Language
CSC204 – Programming I Lecture 4 August 28, 2002.
Lecture 2 Object Oriented Programming Basics of Java Language MBY.
Chapter 2: Java Fundamentals
Chapter 1: Introduction Java Programming Language How the Java Virtual Machine Works (compiling, etc…) Update by: Dan Fleck Coming up: The Java Programming.
Java The Java programming language was created by Sun Microsystems, Inc. It was introduced in 1995 and it's popularity has grown quickly since A programming.
Instructor: Alexander Stoytchev CprE 185: Intro to Problem Solving (using C)
Java Language Basics By Keywords Keywords of Java are given below – abstract continue for new switch assert *** default goto * package.
Quick Review of OOP Constructs Classes:  Data types for structured data and behavior  fields and methods Objects:  Variables whose data type is a class.
© 2011 Pearson Education, publishing as Addison-Wesley Chapter 1: Computer Systems Presentation slides for Java Software Solutions for AP* Computer Science.
Introduction to Java Programming by Laurie Murphy Revised 09/08/2016.
Copyright 2010 by Pearson Education APCS Building Java Programs Chapter 1 Lecture 1-1: Introduction; Basic Java Programs reading:
1 Problem Solving  The purpose of writing a program is to solve a problem  The general steps in problem solving are: Understand the problem Dissect the.
Lecture 1b- Introduction
JAVA MULTIPLE CHOICE QUESTION.
Working with Java.
Chapter 4 Assignment Statement
Chapter No. : 1 Introduction to Java.
Lecture 2: Data Types, Variables, Operators, and Expressions
CSE 190D, Winter 2013 Building Java Programs Chapter 1
University of Central Florida COP 3330 Object Oriented Programming
Chapter 3 Assignment Statement
Introduction to Java Dept. Business Computing University of Winnipeg
Unit 41 – Programing in Java
Starting JavaProgramming
null, true, and false are also reserved.
Introduction to Java Programming
An overview of Java, Data types and variables
Introduction to Algorithm Design
Instructor: Alexander Stoytchev
Chapter 1: Computer Systems
Building Java Programs
Units with – James tedder
Units with – James tedder
JavaScript Reserved Words
Instructor: Alexander Stoytchev
Building Java Programs
Focus of the Course Object-Oriented Software Development
Module 2 - Part 1 Variables, Assignment, and Data Types
CSE 142, Spring 2012 Building Java Programs Chapter 1
Instructor: Alexander Stoytchev
Zorah Fung University of Washington, Spring 2015
CSE 142, Winter 2014 Building Java Programs Chapter 1
Agenda Types and identifiers Practice Assignment Keywords in Java
Zorah Fung University of Washington, Winter 2016
Presentation transcript:

CS-0401 INTERMEDIATE PROGRAMMING USING JAVA Prof. Dr. Paulo Brasko Ferreira Spring 2018

Chapter 1: Introduction to Computers and Java

Chapter Outline Computer Systems Programming Languages Why using Java Bite code and Java Virtual Machine Compiling and Running a Java Program Development Environment Text Editors versus IDEs

Computer Systems Computer Systems can be subdivided into two categories: Hardware Software

Hardware

Software Software: A set of instructions that enables the computer to perform a task Calculates the income tax Simulates a space probe trajectory Software can also be referred as a Program They run on a computer But what do we mean by “computer” nowadays?

Hardware and platforms An ordinary day in Annita’s life…

What platforms can we program?

What abilities should an useful program have?

Store data via Identifiers and Variables Get data in Your program Control Structures Get data out Statements and Expressions

Programming Languages Program is a set of instructions Different types of programming languages out there: Basic Pascal C C++ Fortran Perl PHP Python Cobol C# JavaScript Ruby Java Visual Basic No language is best for every single application

Why are we using Java instead of C++ to create our programs in this course?

Basic programming steps ? ? ?

Interpreter / compiler Good morning! (Happy because she finally understands what he is saying!) Compiler

A small problem in this picture… - What happens if you are in a meeting with many people from different countries? - You would need an interpreter for each spoken language!!!

Why is this a problem? Mac Linux Windows

Java Features

Java is an Interpreted Language Compiler (javac) Byte Code (.class) The “interpreter”. It comes with Java Installation. It’s called when you run your program with “java”. Source Code (.java)

Platform Independent Your Responsibility Windows Mac Linux Solaris User Responsibility

Notes on Interpreting Code Interpreter code executes more slowly than regular compiled code C, C++ Great for distribution over multiple platforms For faster Java run-times, one can use JIT compilation of the bytecode

Writing your Java Program

Before writing our first Java program, let’s ask ourselves: “Which editor should we use to write our Java code?”

You could use notepad-like editors

But we really should be using an IDE!

NetBeans Installation Instructions Search for “Netbeans download” Download JDK with Netbeans IDE bundle Video #01: How to Install Netbeans and Java in your Computer

Compiling and Running your Java Program

Manually Compiling a Java code Compiling the java code: javac Filename Example: Payroll.java will be “translated to” Payroll.class (bytecode) Payroll.class will be the one to be interpreted by the JVM

Running the java class Running the java code: java Filename Example:

For more information on compiling and running your codes Video Library For more information on compiling and running your codes Course website >> Video Library >> Videos on How to Compile … >> Video #03: Compiling and Running Java in a Terminal Window

Compiling and Running Our First Java Code

Computing how much you will earn in a week of work $25 per hour 40 hours a week How to compute the weekly income in this specific case?

Our First Java Code See Payroll.java public class Payroll { public static void main(String[] args) { int hours = 40; double grossPay, payRate = 25.0; grossPay = hours * payRate; System.out.println(“Your gross pay is $” + grossPay); } See Payroll.java

Remember, we need to compile our code to run it! Our First Java Code Remember, we need to compile our code to run it!

Manually Compiling a Java code Compiling the java code: javac Filename Example: Payroll.java will be “translated to” Payroll.class (bytecode) Payroll.class will be the one to be sent to the JVM

Running the java class Running the java code: java Filename Example: java Payroll

Using IDEs to develop, compile, debug, and running your Java code

Exploring NetBeans Creating the same java program in the IDE Explaining the source code that it generates for you Placing a print command Placing two variables Understanding how the IDE helps you to find errors Debugging your code Executing the code

The Java Language

The Java Reserved Words

The Java Reserved Words abstract continue for new switch assert default goto package synchronized boolean do if private this break double implements protected throw byte else import public throws case enum instanceof return transient catch extends int short try char final interface static void class finally long strictfp** volatile const* float native super while

Any Questions?