CSE 131 Computer Science 1 Module 1: (basics of Java)

Slides:



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

Introduction to programming in java. Input and output to screen with Java program Structure of Java programs Statements Conditional statements.
1 Fall 2008ACS-1903 Chapter 1 Topics Java History Java Programs Why Program? Computer Systems: Hardware and Software Programming Languages What Is a Program.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Datalogi A 1: 8/9. Book: Cay Horstmann: Big Java or Java Consepts.
Java An introduction. Example 1 public class Example1 { public static void main (String [] args) { System.out.println (“This is the first example”); int.
Introduction to a Programming Environment
Computer Science A 1: 3/2. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated.
Copyright 2008 by Pearson Education 1 Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading:
COMP 14: Primitive Data and Objects May 24, 2000 Nick Vallidis.
1 SD1042: Introduction to Software Development SD1042 Introduction to Software Development SCHOOL OF COMPUTING AND TECHNOLOGY Getting Started MODULE TEAM.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Why Program? Computer – programmable machine designed to follow instructions Program – instructions in computer memory to make it do something Programmer.
Chapter Introduction to Computers and Programming 1.
Introducing Java.
1 TOPIC 1 INTRODUCTION TO COMPUTER SCIENCE AND PROGRAMMING Topic 1 Introduction to Computer Science and Programming Notes adapted from Introduction to.
COMP 110 Spring Announcements Computers in class on Friday: Lab Office Hours: Monday 12-2 New students see me after class Administrative Changes.
COMP 110: Introduction to Programming Tyler Johnson January 14, 2009 MWF 11:00AM-12:15PM Sitterson 014.
Catie Welsh January 12, 2011 MWF 1-1:50 pm Sitterson
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
CS 106 Introduction to Computer Science I 01 / 25 / 2010 Instructor: Michael Eckmann.
Arrays (Part 1) Computer Science Erwin High School Fall 2014.
1 Agenda Administration Background Our first C program Working environment Exercise Memory and Variables.
Section 2 Variables National 4/5 Scratch Course. What you should know after this lesson What a variable is Where variables are stored How to get data.
CS 114 – Class 02 Topics  Computer programs  Using the compiler Assignments  Read pages for Thursday.  We will go to the lab on Thursday.
CS 11 java track: lecture 1 Administrivia need a CS cluster account cgi-bin/sysadmin/account_request.cgi need to know UNIX
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
Programming Concept Chapter I Introduction to Java Programming.
CSE 131 Computer Science 1 Module 1: (basics of Java)
CS591x A very brief introduction to Java. Java Developed by Sun Microsystems was intended a language for embedded applications became a general purpose.
Basics of Java IMPORTANT: Read Chap 1-6 of How to think like a… Lecture 3.
How to Run a Java Program CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
How to Run a Java Program CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
What does a computer program look like: a general overview.
Applied Computing Technology Laboratory QuickStart C# Learning to Program in C# Amy Roberge & John Linehan November 7, 2005.
Copyright 2008 by Pearson Education 1 Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading:
1 CS 007: Introduction to Computer Programming Ihsan Ayyub Qazi.
CS101: Introduction to Computer Science Slides adapted from Sedgewick and Wayne Copyright © Your First Java.
Component 4: Introduction to Information and Computer Science Unit 5: Overview of Programming Languages, Including Basic Programming Concepts Lecture 3.
Copyright 2010 by Pearson Education 1 Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading:
CS453 LectureIntroduction1 CS453 Compiler Construction Original Design: Michelle Strout Instructor:Wim Bohm
1 Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading:
Computer Science A 1. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated editor,
ITP 109 Week 2 Trina Gregory Introduction to Java.
CSE 303 Concepts and Tools for Software Development Richard C. Davis UW CSE – 10/11/2006 Lecture 7 – Introduction to C.
CS 106 Introduction to Computer Science I 01 / 24 / 2007 Instructor: Michael Eckmann.
Computer Science I Lab 1 ISMAIL ABUMUHFOUZ | CS 180.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
UFCFY5-30-1Multimedia Studio Coding for Interactive Media Fundamental Concepts.
Lecture 1b- Introduction
Object-Oriented programming for Beginners LEAPS Computing 2015
The need for Programming Languages
Building Java Programs
Beginning C++ Programming
Primitive Data, Variables, Loops (Maybe)
Computer Programming Methodology Introduction to Java
Lecture Note Set 1 Thursday 12-May-05
Writing Methods.
Building Java Programs
Building Java Programs Chapter 2
Building Java Programs
Building Java Programs
Building Java Programs
Building Java Programs
Building Java Programs Chapter 2
Building Java Programs
Building Java Programs
CSC 241: Introduction to Computer Science I
Presentation transcript:

CSE 131 Computer Science 1 Module 1: (basics of Java)

Welcome to CSE 131 Professor: Yixin Chen Head TA: Sam Donohue URL: Discussion forum: All s:

Logistics Structure of the course »Lecture, studios, labs, exams Feel free to ask questions »We move pretty fast (learn it while you are here) »Getting help: office hours, recitations, tutoring Expect to spend lots of time programming »Practice makes perfect Zero tolerance on cheating!! Reading assignment before each lecture »It’s for your best interest to finish it

CS: Automation of processes CS is about automation of computation and processes Computers and computer software are everywhere »laptops, cell phones, game systems, music players, televisions, networks, cars, medical devices, appliances

How Do Computers Work?

A Little About Computers Conceptually very simple Memory is storage of data: an array of numbered storage locations »each location can store a numeric value »each location identified by its address Processor is a device that carries out simple machine instructions M[2] <= M[3] M[2] <= M[3] + M[4] (also, -, *, /,...) if M[3] > M[0] then skip ahead 3 (or “go back 5”) M[M[1]] <= M[2] + M[M[4]] (one location “refers” to another) Modern processor can carry out >10 9 instructions/sec So what is programming? – composing instructions to do a certain task Memory Processor Program

Programming Languages

The Java Programming Language Developed by Sun in 1991 for a Green Project for refrigerators The project failed, but Java thrived Today, 1.1 Billion devices are running java

Welcome to the World of Java

Eclipse Integrated Development Environment (IDE) »“smart” editing of Java programs – continuous syntax checks »compiles program files automatically as necessary »integrated program testing and debugging tools »has plug-ins for version control system (Subversion) Can be a powerful tool for managing large projects »but, can also be a bit overwhelming and mysterious at first »watch the first few Eclipse videos on the web site before lab works the same way in Windows, Mac and Linux

Your First Program public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, world!"); } } »defines a class called HelloWorld (a class defines an object) »class contains a single method called main in Java, the main method is the starting point of a program the main method has an array of arguments (not used here) Any program has one and only one main() method »program “prints” a brief message and halts

Today: understand basic building blocks of JAVA You will be able to »Output a slogan on the screen »Tell if a year is a Leap Year »Calculate the area of a circle »Output anything you like »Do all kinds of calculation

Basic unit: variable A variable in Java is a piece of information stored in a computer’s memory: like a jar holding food Each variable has a type »Like different kinds of jars (different food, size, usage, etc.) Main types: int a; double b; String s; boolean x;

Basic Data Types in Java Type (keyword)MeaningExamplesPrimitive Operators intInteger3, 0, -5, 256+, -, *, / doubleDecimal number1.5, , 0.0+, -, *, / booleantrue or falsetrue, false&&, ||, ! (return boolean:, =,!=, ==) Stringa sequence of characters “hello world”+ (concatenation)

15 Basic Definitions Type. A category of values and a set of operations on such values. Variable. A name that refers to a value of a declared type. Assignment statement. Associates a value with a variable. type

The int type

Integers This surprises most students. Don’t feel bad: experts forget this too sometimes.