Introduction to Computer Science I

Similar documents
Introduction to JAVA

Java Programming Fundamentals - Day Instructor: Jason Yoon Website:

12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments.

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG

Introduction to OOP Using Java Pearson Education, Inc. All rights reserved.

Section 2.2 Your First Program in Java: Printing a Line of Text

4 Programming Fundamentals. Introduction to Programming 1 1

2 rd class Department of Programming. OOP with Java Programming

Table of Contents Date(s) Title/Topic Page #s. Abstraction

Creating a Program in JCreator. JCreator is then used to create our program. But the first step is to create a new file.

Full file at

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language

Introduction to Java. Java Programs Classes, Methods, and Statements Comments Strings Escape Sequences Identifiers Keywords

2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program

Fundamentals of Programming. By Budditha Hettige

Chapter 2, Part I Introduction to C Programming

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.

Introduction To Java. Chapter 1. Origins of the Java Language. Origins of the Java Language. Objects and Methods. Origins of the Java Language

Università degli Studi di Bologna Facoltà di Ingegneria. Principles, Models, and Applications for Distributed Systems M

Getting started with Java

Wentworth Institute of Technology. Engineering & Technology WIT COMP1000. Java Basics

Strings, Strings and characters, String class methods. JAVA Standard Edition

CHAPTER 2 Java Fundamentals

Section 2.2 Your First Program in Java: Printing a Line of Text

Chapter 1 Introduction to Java

Section 2: Introduction to Java. Historical note

CS11 Java. Fall Lecture 1

Chapter 2: Programming Concepts

Networks Programming Engr. Abdul-Rahman Mahmood MS, PMP, MCP, QMR(ISO9001:2000)

C++ Spring Break Packet 11 The Java Programming Language

Copyright 1999 by Deitel & Associates, Inc. All Rights Reserved.

Chapter 2: Data and Expressions

Computational Expression

An overview of Java, Data types and variables

Getting Started with Java. Atul Prakash

Programming Language Basics

For the course, we will be using JCreator as the IDE (Integrated Development Environment).

Introduction to Java Applications; Input/Output and Operators

Lec 3. Compilers, Debugging, Hello World, and Variables

Computational Expression

Lecture 3: Variables and assignment

C: How to Program. Week /Mar/05

Basic Programming Language Syntax

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal

Programming with Java

Fundamentals of Programming Session 4

AP Computer Science A: Java Programming

Full file at

History of Java. Java was originally developed by Sun Microsystems star:ng in This language was ini:ally called Oak Renamed Java in 1995

CS 106 Introduction to Computer Science I

CS111: PROGRAMMING LANGUAGE II

Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal

Lecture 2 Tao Wang 1

Chapter 2: Data and Expressions

Java Programming. Zheng-Liang Lu. Java 301 Summer Department of Computer Science & Information Engineering National Taiwan University

4 WORKING WITH DATA TYPES AND OPERATIONS

Introduction to Computer Science I

CSE 142. Lecture 1 Course Introduction; Basic Java. Portions Copyright 2008 by Pearson Education

Programming with Java

Module 1: Introduction to Computers, Programs, and Java

Lecture Notes. System.out.println( Circle radius: + radius + area: + area); radius radius area area value

Introduction to Java Chapters 1 and 2 The Java Language Section 1.1 Data & Expressions Sections

Chapter 2: Java Fundamentals

8/23/2014. Chapter Topics. Chapter Topics (2) Parts of a Java Program. Parts of a Java Program. Analyzing The Example. Chapter 2: Java Fundamentals

Computational Expression

CSCI 2010 Principles of Computer Science. Data and Expressions 08/09/2013 CSCI

Outline. CIS 110: Introduction to Computer Programming. What is Computer Science? What is computer programming? What is computer science?

Pace University. Fundamental Concepts of CS121 1

Get JAVA. I will just tell you what I did (on January 10, 2017). I went to:

Data and Expressions. Outline. Data and Expressions 12/18/2010. Let's explore some other fundamental programming concepts. Chapter 2 focuses on:

Lecture 7. Instructor: Craig Duckett OUTPUT

First Java Program - Output to the Screen

Chapter 1. Introduction

Fundamentals of Programming. Lecture 3: Introduction to C Programming

Entry Point of Execution: the main Method. Elementary Programming. Learning Outcomes. Development Process

BIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic

CP122 CS I. Chapter 1: Introduction

Building Java Programs

Chapter 1 Introduction to Computers, Programs, and Java

Formatted Output (printf) CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington

c) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance.

Computational Expression

Chapter 2 - Introduction to C Programming

CSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York

2: Basics of Java Programming

CSc Introduction to Computing

JAVA Programming Concepts

Programming. Syntax and Semantics

Welcome to CSE 142! Zorah Fung University of Washington, Spring Building Java Programs Chapter 1 Lecture 1: Introduction; Basic Java Programs

Expressions and Data Types CSC 121 Spring 2017 Howard Rosenthal

Program Fundamentals

Review Chapters 1 to 4. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013

Project 1. Java Control Structures 1/17/2014. Project 1 and Java Intro. Project 1 (2) To familiarize with

We now start exploring some key elements of the Java programming language and ways of performing I/O

TUGCE KEMEROZ - ASLI OZKAN - AYSE TARTAN. Week 12/02/ /02/2007 Lecture Notes:

BASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I

Chapter 2: Data and Expressions

IQTIDAR ALI Lecturer IBMS Agriculture University Peshawar

Chapter 2: Using Data

CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals

Transcription:

Introduction to Computer Science I Introduction to Programming Janyl Jumadinova 22-24 January, 2018

What is Computer Science? A computation is a sequence of well-defined operations that lead from an initial starting point to a desired final outcome 2/23

What is Computer Science? A computation is a sequence of well-defined operations that lead from an initial starting point to a desired final outcome Computer science is the study of computation 2/23

Computer science is the study of computation 3/23

Computer science is the study of computation investigating problems that can be solved computationally 3/23

Computer science is the study of computation investigating problems that can be solved computationally programming languages used to describe computations 3/23

Computer science is the study of computation investigating problems that can be solved computationally programming languages used to describe computations machines that carry out computations 3/23

Computer science is the study of computation investigating problems that can be solved computationally programming languages used to describe computations machines that carry out computations theoretical limits of computation (what is or is not computable) 3/23

Computer science is the study of computation investigating problems that can be solved computationally programming languages used to describe computations machines that carry out computations theoretical limits of computation (what is or is not computable) computational solutions to problems in math, science, medicine, business, education, journalism,... 3/23

Computer science is the study of computation investigating problems that can be solved computationally programming languages used to describe computations machines that carry out computations theoretical limits of computation (what is or is not computable) computational solutions to problems in math, science, medicine, business, education, journalism,... Computers play a key role 3/23

Applications of Computer Science Motion Analysis 4/23

Applications of Computer Science Animated Movies... 5/23

Applications of Computer Science... are made by Computer Scientists 6/23

Applications of Computer Science Think about your interests... You can bet computer scientists are working in these areas! 7/23

What is a computer? 8/23

Hardware/Software Software/hardware relationship: Hardware is controlled by software Software is the collection of instructions that you issue to the computer to perform actions and make decisions 9/23

Simple Structure 10/23

What is Computer Programming? 11/23

What is Computer Programming? Programming is the act of writing usable and useful software A program is a set of instructions 11/23

Programming Language We will use Java programming language in this class Java is a programming language originally developed by Sun Microsystems and released in 1995 as a core component of Sun s Java platform 12/23

Started development in 1991 at Sun Originally called Oak Intended for smart consumer-electronic devices Derives much syntax/concepts from C++ BCPL B C C++ Java HISTORY OF JAVA Development almost halted, but 1993 saw introduction of web; Java was revamped to be able to easily add dynamic content to web pages Formally announced and released in May 1995 Released under GPL to the public in May 2007 13/23

Programming in Java Java is an object-oriented programming language 14/23

Programming in Java Java is an object-oriented programming language Objects are fundamental elements that make up a program 14/23

Programming in Java Java is an object-oriented programming language Objects are fundamental elements that make up a program Java has a library of software, called Java API, that is available for your use 14/23

Java program development process 15/23

Simple first Java Program: Hello World // This is the first program people write in a new language, // the "Hello World!". In Java, this file must be named // Welcome.java, with the first part of the name, Welcome, being // the same as the name of the class. The filename itself // (not the class name) must always end in.java to indicate // to the operating system that it s a java source file. public class Welcome { public static void main ( String args[] ) { System.out.println ( "Hello World!" ); } } 16/23

Comments Comments in Java can be one of three styles: Single line: starts at // anywhere on a line, ends at the end of that line Multi-line: starts with character sequence /* anywhere, ends with character sequence */ anywhere after that can span multiple lines javadoc: starts with character sequence /** anywhere, ends with character sequence */ anywhere, after that uses javadoc utility to create HTML documentation from code 17/23

public class Welcome: public means that something is available across packages (reserved word) Name of the class has to be the same as the name of the.java file 18/23

public class Welcome: public means that something is available across packages (reserved word) Name of the class has to be the same as the name of the.java file public static void main ( String identifier[] ): The particular form of main is required by Java. JVM starts executing here! main is a static method, it is part of its class and not part of objects. Strings in Java are sequence of characters 18/23

public class Welcome: public means that something is available across packages (reserved word) Name of the class has to be the same as the name of the.java file public static void main ( String identifier[] ): The particular form of main is required by Java. JVM starts executing here! main is a static method, it is part of its class and not part of objects. Strings in Java are sequence of characters Braces { } are used to collect statements into a block 18/23

public class Welcome: public means that something is available across packages (reserved word) Name of the class has to be the same as the name of the.java file public static void main ( String identifier[] ): The particular form of main is required by Java. JVM starts executing here! main is a static method, it is part of its class and not part of objects. Strings in Java are sequence of characters Braces { } are used to collect statements into a block Statements in Java end with semicolons. 18/23

Printing println: New line after printing print: No new line printf: Can specify format - may learn this later 19/23

Character Strings string literal in class String ABC This is interesting 91 20/23

Character Strings string literal in class String ABC This is interesting 91 Use print or println methods to print a character string to the terminal System.out.println( CMPSC 111 ); the string CMPSC 111 is a parameter: data sent to a method 20/23

String Concatenation appending one string to the end of another: use + operator This is + interesting Your grade is + 91 21/23

String Concatenation appending one string to the end of another: use + operator This is + interesting Your grade is + 91 + is also used for arithmetic addition System.out.println( Adding + 12 + 23); is not the same as System.out.println( Adding + (12 + 23)); 21/23

Escape Sequences Escape sequences, or escape characters, begin with a slash and are immediately followed by another character. This two-character sequence, inside allows you to control your output (\n, \t, \b) or output characters you wouldn t otherwise be able to (\\, \ ) inside a string. 22/23

Escape Sequences Seq Meaning Example Code \n New line System.out.println( Hi\nThere ); \t Horizontal tab System.out.println( What s\tup? ); \b Backspace System.out.println( Hi\b Hey ); \\ Backslash System.out.println( Back\\Slash ); \ Double quote System.out.println( Dbl\ Quote ); 23/23