Copywrite 2003 Walter Savitch These slides are for the exclusive use of students in CSE 11 at UCSD, Winter quarter 2003. They may not be copied or used.

Slides:



Advertisements
Similar presentations
Object Oriented Programming in Java George Mason University Fall 2011
Advertisements

George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
1 Java Basics. 2 Compiling A “compiler” is a program that translates from one language to another Typically from easy-to-read to fast-to-run e.g. from.
Slides prepared by Rose Williams, Binghamton University Chapter 1 Getting Started 1.1 Introduction to Java.
Transition from C++ to Java Walt Savitch University of California, San Diego
Introduction to Primitives. Overview Today we will discuss: –The eight primitive types, especially int and double –Declaring the types of variables –Operations.
Copywrite 2003 Walter Savitch These slides are for the exclusive use of students in CSE 11 at UCSD, Winter quarter They may not be copied or used.
Datalogi A 1: 8/9. Book: Cay Horstmann: Big Java or Java Consepts.
School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 4: 1 CMT1000: Introduction to Programming Ed Currie Lecture 5a: Input and.
CSE 11 HW 2, 3 and 4 Posted in public and on web Deadlines HW 2 turnin: Wed Jan 22 interview: Saturday January 25.class files in public directory for HW.
Copywrite 2003 Walter Savitch These slides are for the exclusive use of students in CSE 11 at UCSD, Winter quarter They may not be copied or used.
Computer Science A 1: 3/2. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated.
Chapter 8: Introduction to High-level Language Programming Invitation to Computer Science, C++ Version, Third Edition.
Copywrite 2003 Walter Savitch These slides are for the exclusive use of students in CSE 11 at UCSD, Winter quarter They may not be copied or used.
Copywrite 2003 Walter Savitch These slides are for the exclusive use of students in CSE 11 at UCSD, Winter quarter They may not be copied or used.
Hello, world! Dissect HelloWorld.java Compile it Run it.
Lecture 1: Overview of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++ Designed.
CSE 1301 J Lecture 2 Intro to Java Programming Richard Gesick.
CSE 131 Computer Science 1 Module 1: (basics of Java)
Introduction to Information and Computer Science Computer Programming Lecture c This material (Comp4_Unit5c), was developed by Oregon Health and Science.
Classes, Objects, and Methods
11 Getting Started with C# Chapter Objectives You will be able to: 1. Say in general terms how C# differs from C. 2. Create, compile, and run a.
Conditional If Week 3. Lecture outcomes Boolean operators – == (equal ) – OR (||) – AND (&&) If statements User input vs command line arguments.
COMP 110: Introduction to Programming Tyler Johnson January 14, 2009 MWF 11:00AM-12:15PM Sitterson 014.
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.
INTRODUCTION TO JAVA CHAPTER 1 1. WHAT IS JAVA ? Java is a programming language and computing platform first released by Sun Microsystems in The.
1 Introduction to Java Brief history of Java Sample Java Program Compiling & Executing Reading: => Section 1.1.
By Nicholas Policelli An Introduction to Java. Basic Program Structure public class ClassName { public static void main(String[] args) { program statements.
ICS 102 Computer Programming University of Hail College of Computer Science & Engineering Computer Science and Software Engineering Department.
Chapter 1Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Java Byte Code l The Java compiler generates Java Byte Code. (Most.
Spring 2008 Mark Fontenot CSE 1341 Principles of Computer Science I Note Set 2.
CS 11 java track: lecture 1 Administrivia need a CS cluster account cgi-bin/sysadmin/account_request.cgi need to know UNIX
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Programming Concept Chapter I Introduction to Java Programming.
Java means Coffee Java Coffee Beans The name “JAVA” was taken from a cup of coffee.
JAVA: An Introduction to Problem Solving & Programming, 5 th Ed. By Walter Savitch and Frank Carrano. ISBN © 2008 Pearson Education, Inc., Upper.
Netprog: Java Intro1 Crash Course in Java. Netprog: Java Intro2 Why Java? Network Programming in Java is very different than in C/C++ –much more language.
COP3502: Introduction to Computer Science Yashas Shankar.
Chapter 1 Section 1.1 Introduction to Java Slides prepared by Rose Williams, Binghamton University Kenrick Mock, University of Alaska Anchorage.
ICS102: Introduction To Computing King Fahd University of Petroleum & Minerals College of Computer Science & Engineering Information & Computer Science.
Walt Savitch University of California, San Diego
1 Week 12 l Overview of Streams and File I/O l Text File I/O Streams and File I/O.
Lecture.1: Getting Started With Java Jiang (Jen) ZHENG May 9 th, 2005.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
Component 4: Introduction to Information and Computer Science Unit 5: Overview of Programming Languages, Including Basic Programming Concepts Lecture 3.
CSC 1010 Programming for All Lecture 3 Useful Python Elements for Designing Programs Some material based on material from Marty Stepp, Instructor, University.
Chapter 4Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Chapters 4 and 5: Excerpts l Class and Method Definitions l Information.
CSCI S-1 Section 4. Deadlines for Homework 2 Problems 1-8 in Parts C and D – Friday, July 3, 17:00 EST Parts E and F – Tuesday, July 7, 17:00 EST.
COP 2551 Introduction to Object Oriented Programming with Java Topics –Introduction to the Java language –Code Commenting –Java Program Structure –Identifiers.
Computer Science A 1. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated editor,
CS110 Introduction to Programming Lecture 1 January 27, 2004 Ethan Bolker Philosophy Bank: user interface, Java, object model Programming environment Homework.
Lecture 3: More Java Basics Michael Hsu CSULA. Recall From Lecture Two  Write a basic program in Java  The process of writing, compiling, and running.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
Fundamentals of Programming I Overview of Programming
Content Programming Overview The JVM A brief look at Structure
Chapter No. : 1 Introduction to Java.
Java Course Review.
Data types and variables
Programming Language Concepts (CIS 635)
IDENTIFIERS CSC 111.
Chapter 2 Edited by JJ Shepherd
Transition from C++ to Java
IFS410 Advanced Analysis and Design
How to Run a Java Program
Introduction to Java Brief history of Java Sample Java Program
Object Oriented Programming in java
Unit 3: Variables in Java
CS Week 2 Jim Williams, PhD.
Zorah Fung University of Washington, Winter 2016
Presentation transcript:

Copywrite 2003 Walter Savitch These slides are for the exclusive use of students in CSE 11 at UCSD, Winter quarter They may not be copied or used for any other purpose without the written permission of Walter Savitch.

CSE 11 Walter Savitch 3620 APM

CSE 11 = CSE 8A + CSE 8B You do not need to know any Java to take this course, BUT If you have not programmed before in some language, you should not take this course. You do Chapters 1-3 of Savitch text on your own. It should be close to a “a review.”

Text Book Savitch, “Java: An Introduction to Computer Science and Programming,” Second Edition. Some UNIX book of your choice. (A suggestion is on the handout.)

Get Handout and READ IT! You must have a computer account for this course. (It starts cs11w__) All Home Work graded in interviews. All interview in SUNPAL lab APM Teams; HW 1 work alone. All other HW can work in teams of 2.

Home Work Deadlines Two deadlines: turnin deadline, interview deadline. If you miss the turnin deadline, you get zero for the assignment. If you miss the interview deadline by one or two days, you pay a penalty. If you miss the interview deadline by more than two days, you get zero.

No Work Accepted Late for Any Reason Except as already noted for interviews. Read the handout.

Home Work 1 Is on the handout. If you do not pass HW 1 by the deadlines, you must drop the course. No exceptions. If you take an interview before the turnin deadline, you do not need to turn in the assignment. Instructions for turning in assignments will be given in a later lecture.

Home Work 1 Deadlines Correction Turnin deadline Friday January 17. Interview deadline Tuesday January 21. There is a mistake in the deadlines on the handout. Home work 2 deadlines will be immediately after HW 1 deadline. The HW2 turnin deadline may be BEFORE the HW1 interview deadline.

Proctor Hours In public directory On website APPROXIMATELY: M-Th 9AM-10PM F 10Am-6PM Sa noon-6pm

Quizzes Surprise quizzes at end of some lectures. Do not ask “Will there be a quiz today?” Cannot makeup a missed quiz for any reason.

Read the Handout Cheating policy. Meaning of turnin deadlines. Grading policy. No late work policy.

Home Computer You do not need a home computer. If you work on a home computer, you must somehow move your files to the SUNPAL lab for turnin and interviews. Java for your home computer is free on Sun website. See Savitch book preface. Get version 1.4 or higher. (1.2 is good enough.)

UNIX We will use the UNIX operating system in the SUNPAL laboratory for all interviews. Your programs must be on the SUNPAL machine and must compile and run there. You need to know enough UNIX to manipulate files, edit files, compile and run your programs. No UNIX on any quiz or exam. Only test of UNIX is that you can do the interviews in the SUNPAL lab.

Editor You can use any editor you wish in the SUNPAL lab, so long as the proctor can give you an interview.

UNIX commands Learn command line commands. More details in discussion section.

UNIX Commands cp file1 file2 cp file1 directory mv file1 file2 rm file

Wildcards cp * directory cp *.java directory

Directories Often called folders mkdir directoryName cd subdirectoryName cd.. cd ~ Learn about absolute and relative path names.

Java General purpose programming language. Includes GUI (Graphical User Interface) libraries. Includes lots of other libraries. Has Internet stuff, but we will use little of it directly.

Java, What’s Unique? Byte Code Compile a Java program, such as MyProg.java, to byte code, MyProg.class. Interpret byte code using Java Virtual Machine. All but the Java Virtual Machine is portable. Same Java program and same byte code runs on any computer.

Java, What’s Unique? Lots of libraries. Threads: multiple processes (not covered in this class.) Applets (Covered but no big deal)

Object Oriented Programming OOP The accepted way to program now. To you, “programming” and “object oriented programming” mean the same thing. Explained in detail after you know more, but more or less everything you are learning is OOP. Java is an OOP language. So is C++. C is not. If the language has classes it is an OOP language.

Chapters 1-3 Expressions, similar to most all other languages. int n = 5*(count + 7); //Assignment Flow of control. Same as C++; similar to other languages.

Java Types Primitive types: int, double, boolean, char, others. Class types, String and others including all the things that you define in Java.

boolean Is a full fledged type in Java. Values are not and do not convert to integers. Values are true and false. true is not 1, false is not 0.

Spelling Conventions Class names start with an uppercase, for example, String. Variable (and most other things) start with a lowercase, for example, theTime, rate, myStuff, yourStuff. Constants (literals) all uppercse, for example, NUMBER_OF_PEOPLE

Spelling Conventions Do not abbreviate use myFirstScore not myFrSc use timeLimit not tmLim nor tmLimit

Console Output int number = 7; System.out.println(number + “ things”); Screen output: 7 things

Console Input System.out.println(“Enter an integer:”); int number = SavitchIn.readLineInt(); Sets the value of number to the integer types in at the keyboard. The integer must be on a line by iteslf.

SavitchIn.readLineInt() SavitchIn is a class. readLineInt is a method. () indicates no arguments. Returns a value of type int, namely the integer entered at keyboard. Good error messages if user screws up.

SavitchIn A class written in Java. Is not a standard Java library class. The file SavitchIn.java (or SavitchIn.class) must be in the same directory as your program. File SavitchIn.java is with programs on machine in SUNPAL and is on CD in the Savitch text.

SavitchIn readLineInt() readLineDouble() readLineNonWhiteChar() readLine()

readLineNonWhiteChar() Different from other methods Reads the first nonwhite char on a line and discards the rest of the line. The char need not be the only thing on the line. If line is yes it reads the ‘y’

Next time start Chapter 4 Get a course account before you leave today.

public class FirstProgram { public static void main(String[] args) { System.out.println("Hello out there."); char answerLetter; answerLetter = SavitchIn.readLineNonwhiteChar(); if (answerLetter == 'y') System.out.println("Nice weather."); System.out.println("Good-bye."); }

public class NameOfProgram { public static void main(String[] args) { Your Code Goes Here. }