Lecture 2. COMP1406/1006 (the Java course) Fall M. Jason Hinek Carleton University
|
|
- Edward Brett Joseph
- 6 years ago
- Views:
Transcription
1 Lecture 2 COMP1406/1006 (the Java course) Fall 2013 M. Jason Hinek Carleton University
2 today s agenda a quick look back (last Thursday) assignment 0 is posted and is due this Friday at 2pm Java compiling and running a Java program primitive data types (and objects) casting arrays static methods (procedural programming) what s next? 2
3 last time... /* hello world */ public class HelloWorld{ public static void main(string[] args){ System.out.println("hello, world!"); } } access modifier public top level access modifier specifies who can see HelloWorld member level access modifier specifies who can access main (non access) modifier static allows a method to be called without an instance of the class return type void it is a Java keyword that tells us that a method returns nothing it is not an actual Java type System.out System is a class with three attributes/fields in, out and err out is a PrintStream object, it is standard output println is a method of out 3
4 last time... /* hello world */ public class HelloWorld{ public static void main(string[] args){ System.out.println("hello, world!"); } } access modifier public top level access modifier specifies who can see HelloWorld member level access modifier specifies who can access main (non access) modifier static allows a method to be called without an instance of the class return type void it is a Java keyword that tells us that a method returns nothing it is not an actual Java type System.out System is a class with three attributes/fields in, out and err out is a PrintStream object, it is standard output println is a method of out 3
5 last time... /* hello world */ public class HelloWorld{ public static void main(string[] args){ System.out.println("hello, world!"); } } access modifier public top level access modifier specifies who can see HelloWorld member level access modifier specifies who can access main (non access) modifier static allows a method to be called without an instance of the class return type void it is a Java keyword that tells us that a method returns nothing it is not an actual Java type System.out System is a class with three attributes/fields in, out and err out is a PrintStream object, it is standard output println is a method of out 3
6 last time... /* hello world */ public class HelloWorld{ public static void main(string[] args){ System.out.println("hello, world!"); } } access modifier public top level access modifier specifies who can see HelloWorld member level access modifier specifies who can access main (non access) modifier static allows a method to be called without an instance of the class return type void it is a Java keyword that tells us that a method returns nothing it is not an actual Java type System.out System is a class with three attributes/fields in, out and err out is a PrintStream object, it is standard output println is a method of out 3
7 last time... /* hello world */ public class HelloWorld{ public static void main(string[] args){ System.out.println("hello, world!"); } } access modifier public top level access modifier specifies who can see HelloWorld member level access modifier specifies who can access main (non access) modifier static allows a method to be called without an instance of the class return type void it is a Java keyword that tells us that a method returns nothing it is not an actual Java type System.out System is a class with three attributes/fields in, out and err out is a PrintStream object, it is standard output println is a method of out 3
8 last time... /* hello world */ public class HelloWorld{ public static void main(string[] args){ System.out.println("hello, world!"); } } what do we know about System.out.println()? 4
9 last time... /* hello world */ public class HelloWorld{ public static void main(string[] args){ System.out.println("hello, world!"); } } what do we know about System.out.println()? we can look at the API for the System class <link> API - application programming interface specifies how to use a given class 4
10 assignment 0 academic regulations coding style for COMP1406/1006 basic Java programs using just a main method using command line arguments assignment 1 user input procedural programming testing writing methods 5
11 assignment 0 academic regulations coding style for COMP1406/1006 basic Java programs using just a main method using command line arguments assignment 1 user input procedural programming testing writing methods 5
12 running hello world /* Java hello world */ public class HelloWorld{ public static void main(string[] args){ System.out.println("hello, world!"); } } Java convention is that class name is capitalized (use camel case if more than one word) class XXX must be in the file XXX.java so HellowWorld must be in the file HelloWorld.java first we need to compile the source code into Java bytecode IDE will have a compile button javac HelloWorld.java from console window (shell) this creates HelloWorld.class, which is the Java bytecode next, we run the bytecode in the JVM (Java virtual machine) java HelloWorld from the console window runs out program! the JVM executes the main method of our program 6
13 running hello world /* Java hello world */ public class HelloWorld { public static void main(string[] args){ System.out.println("hello, world!"); } } Java convention is that class name is capitalized (use camel case if more than one word) class XXX must be in the file XXX.java so HellowWorld must be in the file HelloWorld.java first we need to compile the source code into Java bytecode IDE will have a compile button javac HelloWorld.java from console window (shell) this creates HelloWorld.class, which is the Java bytecode next, we run the bytecode in the JVM (Java virtual machine) java HelloWorld from the console window runs out program! the JVM executes the main method of our program 6
14 running hello world /* Java hello world */ public class HelloWorld{ public static void main(string[] args){ System.out.println("hello, world!"); } } Java convention is that class name is capitalized (use camel case if more than one word) class XXX must be in the file XXX.java so HellowWorld must be in the file HelloWorld.java first we need to compile the source code into Java bytecode IDE will have a compile button javac HelloWorld.java from console window (shell) this creates HelloWorld.class, which is the Java bytecode next, we run the bytecode in the JVM (Java virtual machine) java HelloWorld from the console window runs out program! the JVM executes the main method of our program 6
15 running hello world /* Java hello world */ public class HelloWorld{ public static void main(string[] args){ System.out.println("hello, world!"); } } Java convention is that class name is capitalized (use camel case if more than one word) class XXX must be in the file XXX.java so HellowWorld must be in the file HelloWorld.java first we need to compile the source code into Java bytecode IDE will have a compile button javac HelloWorld.java from console window (shell) this creates HelloWorld.class, which is the Java bytecode next, we run the bytecode in the JVM (Java virtual machine) java HelloWorld from the console window runs out program! the JVM executes the main method of our program 6
16 running hello world /* Java hello world */ public class HelloWorld{ public static void main(string[] args){ System.out.println("hello, world!"); } } Java convention is that class name is capitalized (use camel case if more than one word) class XXX must be in the file XXX.java so HellowWorld must be in the file HelloWorld.java first we need to compile the source code into Java bytecode IDE will have a compile button javac HelloWorld.java from console window (shell) this creates HelloWorld.class, which is the Java bytecode next, we run the bytecode in the JVM (Java virtual machine) java HelloWorld from the console window runs out program! the JVM executes the main method of our program 6
17 running Java programs XXX.java 7
18 running Java programs XXX.java 7
19 running Java programs XXX.java javac XXX.java 7
20 running Java programs XXX.java javac XXX.java 7
21 running Java programs XXX.java javac XXX.java java.class 7
22 running Java programs XXX.java javac XXX.java java.class 7
23 running Java programs XXX.java javac XXX.java java.class java XXX 7
24 running Java programs XXX.java javac XXX.java java.class java XXX 7
25 running Java programs XXX.java javac XXX.java java.class java XXX!!??!! 7
26 command line arguments vs user input both are ways of providing some information to your program command line arguments input is entered before program runs input is passed as parameters to main method (args) (not practical for many user inputs) user input input is entered while program is running standard input is the keyboard (very flexible and useful) 8
27 let s take a break... for 3 minutes 9
28 Java date types in Java, everything is an object 10
29 Java date types in Java, everything is an object except for the 8 things that aren t! 10
30 Java date types in Java, everything is an object except for the 8 things that aren t! Java has eight primitive data types byte, short, int, long float, double boolean char (integers) (approximate real numbers) (logical true/false) (unicode characters) 10
31 Java date types there are four primitive data types for exact integers byte 8-bit signed integers short 16-bit signed integers 32, , 767 int 32-bit signed integers 2,147,483,648 2,147,483,647 long 64-bit signed integers 9,223,372,036,854,775,808 9,223,372,036,854,775,807 11
32 Java date types there are two primitive data types for approximate decimal numbers (approximation to real numbers) float 32-bit IEEE 754 floating point 1 bit for sign, 8 bits for exponent, 23 bits for fraction accuracy about 7 decimal digits of accuracy double 64-bit IEEE 754 floating point 1 bit for sign, 11 bits for exponent, 52 bits for fraction accuracy about decimal digits of accuracy 12
33 Java date types and two more... boolean true or false char 16-bit Unicode character chars enclosed in single quotes x, 3, Q, etc from \u0000 (zero) to \uffff (65,635) unlike other languages, char is not equivalent to a byte (8-bits) 13
34 type conversion automatic type conversion JVM will do some conversions for you explicit type conversion cast use a method 14
35 type conversion automatic type conversion JVM will do some conversions for you explicit type conversion cast use a method expression cat + 22 Integer.parseInt( 32 ) (int) Math.round(2.1) 11 * 0.3 (int) 11 * * (int) 0.3 (int) (11*0.3) expression value 14
36 type conversion automatic type conversion JVM will do some conversions for you explicit type conversion cast use a method expression expression value cat + 22 cat22 String Integer.parseInt( 32 ) (int) Math.round(2.1) 11 * 0.3 (int) 11 * * (int) 0.3 (int) (11*0.3) 14
37 type conversion automatic type conversion JVM will do some conversions for you explicit type conversion cast use a method expression expression value cat + 22 cat22 String Integer.parseInt( 32 ) 32 int (int) Math.round(2.1) 11 * 0.3 (int) 11 * * (int) 0.3 (int) (11*0.3) 14
38 type conversion automatic type conversion JVM will do some conversions for you explicit type conversion cast use a method expression expression value cat + 22 cat22 String Integer.parseInt( 32 ) 32 int (int) int Math.round(2.1) 11 * 0.3 (int) 11 * * (int) 0.3 (int) (11*0.3) 14
39 type conversion automatic type conversion JVM will do some conversions for you explicit type conversion cast use a method expression expression value cat + 22 cat22 String Integer.parseInt( 32 ) 32 int (int) int Math.round(2.1) 2 int 11 * 0.3 (int) 11 * * (int) 0.3 (int) (11*0.3) 14
40 type conversion automatic type conversion JVM will do some conversions for you explicit type conversion cast use a method expression expression value cat + 22 cat22 String Integer.parseInt( 32 ) 32 int (int) int Math.round(2.1) 2 int 11 * float (int) 11 * * (int) 0.3 (int) (11*0.3) 14
41 type conversion automatic type conversion JVM will do some conversions for you explicit type conversion cast use a method expression expression value cat + 22 cat22 String Integer.parseInt( 32 ) 32 int (int) int Math.round(2.1) 2 int 11 * float (int) 11 * float 11 * (int) 0.3 (int) (11*0.3) 14
42 type conversion automatic type conversion JVM will do some conversions for you explicit type conversion cast use a method expression expression value cat + 22 cat22 String Integer.parseInt( 32 ) 32 int (int) int Math.round(2.1) 2 int 11 * float (int) 11 * float 11 * (int) int (int) (11*0.3) 14
43 type conversion automatic type conversion JVM will do some conversions for you explicit type conversion cast use a method expression expression value cat + 22 cat22 String Integer.parseInt( 32 ) 32 int (int) int Math.round(2.1) 2 int 11 * float (int) 11 * float 11 * (int) int (int) (11*0.3) 3 int 14
44 operator precedence order matters! 15
45 operator precedence order matters! BEDMAS 15
46 operator precedence order matters! BEDMAS elementary school... brackets exponents division and multiplication addition and subtraction 15
47 operator precedence 15
48 arrays and memory models let s look at arrays in Java... and lets draw pictures... 16
49 what s next? tutorial this week creating, compiling and running Java programs command line arguments/user input arrays next class towards OOP testing your code blackbox testing whitebox testing errors 17
CS 11 java track: lecture 1
CS 11 java track: lecture 1 Administrivia need a CS cluster account http://www.cs.caltech.edu/ cgi-bin/sysadmin/account_request.cgi need to know UNIX www.its.caltech.edu/its/facilities/labsclusters/ unix/unixtutorial.shtml
More informationDay 2. COMP 1006/1406A Summer M. Jason Hinek Carleton University
Day 2 COMP 1006/1406A Summer 2016 M. Jason Hinek Carleton University today s agenda a quick look back (Monday s class) assignments a1 is due on Monday a2 will be available on Monday and is due the following
More informationJava Bytecode (binary file)
Java is Compiled Unlike Python, which is an interpreted langauge, Java code is compiled. In Java, a compiler reads in a Java source file (the code that we write), and it translates that code into bytecode.
More informationProgram Fundamentals
Program Fundamentals /* HelloWorld.java * The classic Hello, world! program */ class HelloWorld { public static void main (String[ ] args) { System.out.println( Hello, world! ); } } /* HelloWorld.java
More informationIntroduction Basic elements of Java
Software and Programming I Introduction Basic elements of Java Roman Kontchakov / Carsten Fuhs Birkbeck, University of London Module Information Time: Thursdays in the Spring term Lectures: MAL B04: 2
More informationCS 231 Data Structures and Algorithms, Fall 2016
CS 231 Data Structures and Algorithms, Fall 2016 Dr. Bruce A. Maxwell Department of Computer Science Colby College Course Description Focuses on the common structures used to store data and the standard
More informationInf1-OOP. Textbooks. Who and What. Organisational issues. Why Java? Course Overview. Hello, World! in Java
Organisational issues Inf1-OOP Course Overview Perdita Stevens, adapting earlier version by Ewan Klein School of Informatics January 11, 2014 Why Java? Hello, World! in Java Built-in Types Integers Floating-Point
More informationInf1-OOP. Textbooks. Who and What. Organizational Issues. Why Java? Course Overview. Hello, World! in Java. Ewan Klein, Perdita Stevens
Organizational Issues Inf1-OOP Course Overview Ewan Klein, Perdita Stevens School of Informatics January 12, 2013 Why Java? Hello, World! in Java Built-in Types Integers Floating-Point Numbers Type Conversion
More informationLec 3. Compilers, Debugging, Hello World, and Variables
Lec 3 Compilers, Debugging, Hello World, and Variables Announcements First book reading due tonight at midnight Complete 80% of all activities to get 100% HW1 due Saturday at midnight Lab hours posted
More informationInf1-OP. Course Overview. Volker Seeker, adapting earlier version by Perdita Stevens and Ewan Klein. February 26, School of Informatics
Inf1-OP Course Overview Volker Seeker, adapting earlier version by Perdita Stevens and Ewan Klein School of Informatics February 26, 2018 Administrative Stuff Who to contact for help? Lecturer: Volker
More informationWho and what can help? Inf1-OP. Lecturer: Timothy Hospedales TA: Natalia Zon
Who and what can help? Inf1-OP Lecturer: Timothy Hospedales TA: Natalia Zon Course Overview Web: http://www.inf.ed.ac.uk/teaching/ courses/inf1/op/ Timothy Hospedales, adapting earlier version by Perdita
More informationSoftware and Programming 1
Software and Programming 1 Lab 1: Introduction, HelloWorld Program and use of the Debugger 17 January 2019 SP1-Lab1-2018-19.pptx Tobi Brodie (tobi@dcs.bbk.ac.uk) 1 Module Information Lectures: Afternoon
More informationMODULE 02: BASIC COMPUTATION IN JAVA
MODULE 02: BASIC COMPUTATION IN JAVA Outline Variables Naming Conventions Data Types Primitive Data Types Review: int, double New: boolean, char The String Class Type Conversion Expressions Assignment
More informationBasics of Java Programming
Basics of Java Programming Lecture 2 COP 3252 Summer 2017 May 16, 2017 Components of a Java Program statements - A statement is some action or sequence of actions, given as a command in code. A statement
More informationProgramming Language Concepts: Lecture 2
Programming Language Concepts: Lecture 2 Madhavan Mukund Chennai Mathematical Institute madhavan@cmi.ac.in http://www.cmi.ac.in/~madhavan/courses/pl2011 PLC 2011, Lecture 2, 6 January 2011 Classes and
More information13 th Windsor Regional Secondary School Computer Programming Competition
SCHOOL OF COMPUTER SCIENCE 13 th Windsor Regional Secondary School Computer Programming Competition Hosted by The School of Computer Science, University of Windsor WORKSHOP I [ Overview of the Java/Eclipse
More informationAn overview of Java, Data types and variables
An overview of Java, Data types and variables Lecture 2 from (UNIT IV) Prepared by Mrs. K.M. Sanghavi 1 2 Hello World // HelloWorld.java: Hello World program import java.lang.*; class HelloWorld { public
More informationInterpreted vs Compiled. Java Compile. Classes, Objects, and Methods. Hello World 10/6/2016. Python Interpreted. Java Compiled
Interpreted vs Compiled Python 1 Java Interpreted Easy to run and test Quicker prototyping Program runs slower Compiled Execution time faster Virtual Machine compiled code portable Java Compile > javac
More informationLecture 02, Fall 2018 Friday September 7
Anatomy of a class Oliver W. Layton CS231: Data Structures and Algorithms Lecture 02, Fall 2018 Friday September 7 Follow-up Python is also cross-platform. What s the advantage of Java? It s true: Python
More informationDATA TYPES AND EXPRESSIONS
DATA TYPES AND EXPRESSIONS Outline Variables Naming Conventions Data Types Primitive Data Types Review: int, double New: boolean, char The String Class Type Conversion Expressions Assignment Mathematical
More informationExpressions and Data Types CSC 121 Fall 2015 Howard Rosenthal
Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types and
More informationCOMP-202 Unit 2: Java Basics. CONTENTS: Using Expressions and Variables Types Strings Methods
COMP-202 Unit 2: Java Basics CONTENTS: Using Expressions and Variables Types Strings Methods Assignment 1 Assignment 1 posted on WebCt and course website. It is due May 18th st at 23:30 Worth 6% Part programming,
More informationCS11 Java. Fall Lecture 1
CS11 Java Fall 2006-2007 Lecture 1 Welcome! 8 Lectures Slides posted on CS11 website http://www.cs.caltech.edu/courses/cs11 7-8 Lab Assignments Made available on Mondays Due one week later Monday, 12 noon
More informationGoals. Java - An Introduction. Java is Compiled and Interpreted. Architecture Neutral & Portable. Compiled Languages. Introduction to Java
Goals Understand the basics of Java. Introduction to Java Write simple Java Programs. 1 2 Java - An Introduction Java is Compiled and Interpreted Java - The programming language from Sun Microsystems Programmer
More informationChapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. Overview. Objectives. Teaching Tips. Quick Quizzes. Class Discussion Topics
Java Programming, Sixth Edition 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional Projects Additional
More information1. Download the JDK 6, from
1. Install the JDK 1. Download the JDK 6, from http://java.sun.com/javase/downloads/widget/jdk6.jsp. 2. Once the file is completed downloaded, execute it and accept the license agreement. 3. Select the
More informationComputer Components. Software{ User Programs. Operating System. Hardware
Computer Components Software{ User Programs Operating System Hardware What are Programs? Programs provide instructions for computers Similar to giving directions to a person who is trying to get from point
More informationFull file at
Java Programming, Fifth Edition 2-1 Chapter 2 Using Data within a Program At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional
More informationOutline. Overview. Control statements. Classes and methods. history and advantage how to: program, compile and execute 8 data types 3 types of errors
Outline Overview history and advantage how to: program, compile and execute 8 data types 3 types of errors Control statements Selection and repetition statements Classes and methods methods... 2 Oak A
More informationCS5000: Foundations of Programming. Mingon Kang, PhD Computer Science, Kennesaw State University
CS5000: Foundations of Programming Mingon Kang, PhD Computer Science, Kennesaw State University Overview of Source Code Components Comments Library declaration Classes Functions Variables Comments Can
More informationTools : The Java Compiler. The Java Interpreter. The Java Debugger
Tools : The Java Compiler javac [ options ] filename.java... -depend: Causes recompilation of class files on which the source files given as command line arguments recursively depend. -O: Optimizes code,
More informationExpressions and Data Types CSC 121 Spring 2015 Howard Rosenthal
Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types
More informationCOMP 110 Introduction to Programming. What did we discuss?
COMP 110 Introduction to Programming Fall 2015 Time: TR 9:30 10:45 Room: AR 121 (Hanes Art Center) Jay Aikat FB 314, aikat@cs.unc.edu Previous Class What did we discuss? COMP 110 Fall 2015 2 1 Today Announcements
More informationAdministrative Stuff. Inf1-OP. Additional help? Who to contact for help? Course Overview
nf1-op Course Overview Volker Seeker, adapting earlier version by Perdita Stevens and Ewan Klein Administrative Stuff School of nformatics February 26, 2018 Who to contact for help? Additional help? Lecturer:
More informationCOSC 123 Computer Creativity. Introduction to Java. Dr. Ramon Lawrence University of British Columbia Okanagan
COSC 123 Computer Creativity Introduction to Java Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Key Points 1) Introduce Java, a general-purpose programming language,
More informationGetting started with Java
Getting started with Java by Vlad Costel Ungureanu for Learn Stuff Programming Languages A programming language is a formal constructed language designed to communicate instructions to a machine, particularly
More informationComputer Science II Lecture 1 Introduction and Background
Computer Science II Lecture 1 Introduction and Background Discussion of Syllabus Instructor, TAs, office hours Course web site, http://www.cs.rpi.edu/courses/fall04/cs2, will be up soon Course emphasis,
More informationGetting started with Java
Getting started with Java Magic Lines public class MagicLines { public static void main(string[] args) { } } Comments Comments are lines in your code that get ignored during execution. Good for leaving
More information3. Java - Language Constructs I
Educational Objectives 3. Java - Language Constructs I Names and Identifiers, Variables, Assignments, Constants, Datatypes, Operations, Evaluation of Expressions, Type Conversions You know the basic blocks
More informationOutline. Parts 1 to 3 introduce and sketch out the ideas of OOP. Part 5 deals with these ideas in closer detail.
OOP in Java 1 Outline 1. Getting started, primitive data types and control structures 2. Classes and objects 3. Extending classes 4. Using some standard packages 5. OOP revisited Parts 1 to 3 introduce
More informationFull file at
Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class
More informationGaddis: Starting Out with Java: From Control Structures through Objects, 6/e
Chapter 2 MULTIPLE CHOICE 1. Which one of the following would contain the translated Java byte code for a program named Demo? a. Demo.java b. Demo.code c. Demo.class d. Demo.byte 2. To compile a program
More informationValues and Variables 1 / 30
Values and Variables 1 / 30 Values 2 / 30 Computing Computing is any purposeful activity that marries the representation of some dynamic domain with the representation of some dynamic machine that provides
More informationLecture Notes CPSC 224 (Spring 2012) Today... Java basics. S. Bowers 1 of 8
Today... Java basics S. Bowers 1 of 8 Java main method (cont.) In Java, main looks like this: public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World!"); Q: How
More informationWhat did we talk about last time? Examples switch statements
Week 4 - Friday What did we talk about last time? Examples switch statements History of computers Hardware Software development Basic Java syntax Output with System.out.print() Mechanical Calculation
More informationCMSC131. Introduction to your Introduction to Java. Why Java?
CMSC131 Introduction to your Introduction to Java Why Java? It s a popular language in both industry and introductory programming courses. It makes use of programming structures and techniques that can
More informationStarting Out with Java: From Control Structures through Data Structures 3e (Gaddis and Muganda) Chapter 2 Java Fundamentals
Starting Out with Java: From Control Structures through Data Structures 3e (Gaddis and Muganda) Chapter 2 Java Fundamentals 2.1 Multiple Choice Questions 1) Which one of the following would contain the
More informationAdvanced Computer Programming
Programming in the Small I: Names and Things (Part II) 188230 Advanced Computer Programming Asst. Prof. Dr. Kanda Runapongsa Saikaew (krunapon@kku.ac.th) Department of Computer Engineering Khon Kaen University
More informationINDEX. A SIMPLE JAVA PROGRAM Class Declaration The Main Line. The Line Contains Three Keywords The Output Line
A SIMPLE JAVA PROGRAM Class Declaration The Main Line INDEX The Line Contains Three Keywords The Output Line COMMENTS Single Line Comment Multiline Comment Documentation Comment TYPE CASTING Implicit Type
More informationSoftware and Programming 1
Software and Programming 1 Lab 1: Introduction, HelloWorld Program and use of the Debugger 11 January 2018 SP1-Lab1-2017-18.pptx Tobi Brodie (tobi@dcs.bbk.ac.uk) 1 Module Information Lectures: Afternoon
More informationFall 2017 CISC124 9/16/2017
CISC124 Labs start this week in JEFF 155: Meet your TA. Check out the course web site, if you have not already done so. Watch lecture videos if you need to review anything we have already done. Problems
More informationExpressions and Data Types CSC 121 Spring 2017 Howard Rosenthal
Expressions and Data Types CSC 121 Spring 2017 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types
More informationIntroduction to Java https://tinyurl.com/y7bvpa9z
Introduction to Java https://tinyurl.com/y7bvpa9z Eric Newhall - Laurence Meyers Team 2849 Alumni Java Object-Oriented Compiled Garbage-Collected WORA - Write Once, Run Anywhere IDE Integrated Development
More informationCSE115 / CSE503 Introduction to Computer Science I Dr. Carl Alphonce 343 Davis Hall Office hours:
CSE115 / CSE503 Introduction to Computer Science I Dr. Carl Alphonce 343 Davis Hall alphonce@buffalo.edu Office hours: Tuesday 10:00 AM 12:00 PM * Wednesday 4:00 PM 5:00 PM Friday 11:00 AM 12:00 PM OR
More information1.1 Your First Program
1.1 Your First Program Introduction to Programming in Java: An Interdisciplinary Approach Robert Sedgewick and Kevin Wayne Copyright 2002 2010 5/20/2013 9:37:22 AM Why Programming? Why programming? Need
More informationCOMP-202: Foundations of Programming
COMP-202: Foundations of Programming Lecture 3: Basic data types Jackie Cheung, Winter 2016 Review: Hello World public class HelloWorld { } public static void main(string[] args) { } System.out.println("Hello,
More informationPROGRAMMING FUNDAMENTALS
PROGRAMMING FUNDAMENTALS Q1. Name any two Object Oriented Programming languages? Q2. Why is java called a platform independent language? Q3. Elaborate the java Compilation process. Q4. Why do we write
More informationJava Programming. Atul Prakash
Java Programming Atul Prakash Java Language Fundamentals The language syntax is similar to C/ C++ If you know C/C++, you will have no trouble understanding Java s syntax If you don't, it will be easier
More informationJava Basic Programming Constructs
Java Basic Programming Constructs /* * This is your first java program. */ class HelloWorld{ public static void main(string[] args){ System.out.println( Hello World! ); A Closer Look at HelloWorld 2 This
More informationChapter 2: Data and Expressions
Chapter 2: Data and Expressions CS 121 Department of Computer Science College of Engineering Boise State University January 15, 2015 Chapter 2: Data and Expressions CS 121 1 / 1 Chapter 2 Part 1: Data
More information! Widely available. ! Widely used. ! Variety of automatic checks for mistakes in programs. ! Embraces full set of modern abstractions. Caveat.
Why Java? Lecture 2: Intro to Java Java features.! Widely available.! Widely used.! Variety of automatic checks for mistakes in programs.! Embraces full set of modern abstractions. Caveat.! No perfect
More informationBasic Operations jgrasp debugger Writing Programs & Checkstyle
Basic Operations jgrasp debugger Writing Programs & Checkstyle Suppose you wanted to write a computer game to play "Rock, Paper, Scissors". How many combinations are there? Is there a tricky way to represent
More informationProgramming Language Basics
Programming Language Basics Lecture Outline & Notes Overview 1. History & Background 2. Basic Program structure a. How an operating system runs a program i. Machine code ii. OS- specific commands to setup
More information12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments.
Java How to Program, 9/e Education, Inc. All Rights Reserved. } Java application programming } Use tools from the JDK to compile and run programs. } Videos at www.deitel.com/books/jhtp9/ Help you get started
More informationAdministration. Classes. Objects Part II. Agenda. Review: Object References. Object Aliases. CS 99 Summer 2000 Michael Clarkson Lecture 7
Administration Classes CS 99 Summer 2000 Michael Clarkson Lecture 7 Lab 7 due tomorrow Question: Lab 6.equals( SquareRoot )? Lab 8 posted today Prelim 2 in six days! Covers two weeks of material: lectures
More informationBASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I
BASIC COMPUTATION x public static void main(string [] args) Fundamentals of Computer Science I Outline Using Eclipse Data Types Variables Primitive and Class Data Types Expressions Declaration Assignment
More informationBranching and Boolean Expressions
Software and Programming I Branching and Boolean Expressions Roman Kontchakov / Carsten Fuhs Birkbeck, University of London Outline The if statement Comparing numbers and strings Nested branches Boolean
More information1 Introduction Java, the beginning Java Virtual Machine A First Program BlueJ Raspberry Pi...
Contents 1 Introduction 3 1.1 Java, the beginning.......................... 3 1.2 Java Virtual Machine........................ 4 1.3 A First Program........................... 4 1.4 BlueJ.................................
More information1 class Lecture2 { 2 3 "Elementray Programming" / References 8 [1] Ch. 2 in YDL 9 [2] Ch. 2 and 3 in Sharan 10 [3] Ch.
1 class Lecture2 { 2 3 "Elementray Programming" 4 5 } 6 7 / References 8 [1] Ch. 2 in YDL 9 [2] Ch. 2 and 3 in Sharan 10 [3] Ch. 2 in HS 11 / Zheng-Liang Lu Java Programming 41 / 68 Example Given the radius
More informationEntry Point of Execution: the main Method. Elementary Programming. Learning Outcomes. Development Process
Entry Point of Execution: the main Method Elementary Programming EECS1021: Object Oriented Programming: from Sensors to Actuators Winter 2019 CHEN-WEI WANG For now, all your programming exercises will
More informationLecture 3. COMP1006/1406 (the Java course) Summer M. Jason Hinek Carleton University
Lecture 3 COMP1006/1406 (the Java course) Summer 2014 M. Jason Hinek Carleton University today s agenda assignments 1 (graded) & 2 3 (available now) & 4 (tomorrow) a quick look back primitive data types
More informationCSCI 2010 Principles of Computer Science. Data and Expressions 08/09/2013 CSCI
CSCI 2010 Principles of Computer Science Data and Expressions 08/09/2013 CSCI 2010 1 Data Types, Variables and Expressions in Java We look at the primitive data types, strings and expressions that are
More informationObject-Oriented Programming
Object-Oriented Programming Java Syntax Program Structure Variables and basic data types. Industry standard naming conventions. Java syntax and coding conventions If Then Else Case statements Looping (for,
More informationKickstart Intro to Java Part I
Kickstart Intro to Java Part I COMP346/5461 - Operating Systems Revision 1.6 February 9, 2004 1 Topics Me, Myself, and I Why Java 1.2.*? Setting Up the Environment Buzz about Java Java vs. C++ Basic Java
More informationCS 177 Recitation. Week 1 Intro to Java
CS 177 Recitation Week 1 Intro to Java Questions? Computers Computers can do really complex stuff. How? By manipulating data according to lists of instructions. Fundamentally, this is all that a computer
More informationComputational Expression
Computational Expression Variables, Primitive Data Types, Expressions Janyl Jumadinova 28-30 January, 2019 Janyl Jumadinova Computational Expression 28-30 January, 2019 1 / 17 Variables Variable is a name
More information4 Programming Fundamentals. Introduction to Programming 1 1
4 Programming Fundamentals Introduction to Programming 1 1 Objectives At the end of the lesson, the student should be able to: Identify the basic parts of a Java program Differentiate among Java literals,
More informationCOMP Primitive and Class Types. Yi Hong May 14, 2015
COMP 110-001 Primitive and Class Types Yi Hong May 14, 2015 Review What are the two major parts of an object? What is the relationship between class and object? Design a simple class for Student How to
More informationAssoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.
Assoc. Prof. Dr. Marenglen Biba (C) 2010 Pearson Education, Inc. All rights reserved. Java application A computer program that executes when you use the java command to launch the Java Virtual Machine
More informationB.V. Patel Institute of BMC & IT, UTU 2014
BCA 3 rd Semester 030010301 - Java Programming Unit-1(Java Platform and Programming Elements) Q-1 Answer the following question in short. [1 Mark each] 1. Who is known as creator of JAVA? 2. Why do we
More informationIntroduction To Java. Chapter 1. Origins of the Java Language. Origins of the Java Language. Objects and Methods. Origins of the Java Language
Chapter 1 Getting Started Introduction To Java Most people are familiar with Java as a language for Internet applications We will study Java as a general purpose programming language The syntax of expressions
More information4. If the following Java statements are executed, what will be displayed?
Chapter 2 MULTIPLE CHOICE 1. To compile a program named First, use the following command a. java First.java b. javac First c. javac First.java d. compile First.javac 2. A Java program must have at least
More information1.1 Your First Program
1.1 Your First Program Introduction to Programming in Java: An Interdisciplinary Approach Robert Sedgewick and Kevin Wayne Copyright 2002 2010 1/29/11 6:37 AM! Why Programming? Why programming? Need to
More informationWelcome to the Primitives and Expressions Lab!
Welcome to the Primitives and Expressions Lab! Learning Outcomes By the end of this lab: 1. Be able to define chapter 2 terms. 2. Describe declarations, variables, literals and constants for primitive
More informationCS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University
CS 112 Introduction to Computing II Wayne Snyder Department Boston University Today: Java basics: Compilation vs Interpretation Program structure Statements Values Variables Types Operators and Expressions
More informationCSC Java Programming, Fall Java Data Types and Control Constructs
CSC 243 - Java Programming, Fall 2016 Java Data Types and Control Constructs Java Types In general, a type is collection of possible values Main categories of Java types: Primitive/built-in Object/Reference
More informationMidterms Save the Dates!
University of British Columbia CPSC 111, Intro to Computation Alan J. Hu Primitive Data Types Arithmetic Operators Readings Your textbook is Big Java (3rd Ed). This Week s Reading: Ch 2.1-2.5, Ch 4.1-4.2.
More informationA very simple program. Week 2: variables & expressions. Declaring variables. Assignments: examples. Initialising variables. Assignments: pattern
School of Computer Science, University of Birmingham. Java Lecture notes. M. D. Ryan. September 2001. A very simple program Week 2: variables & expressions Variables, assignments, expressions, and types.
More informationChapter 2 Elementary Programming
Chapter 2 Elementary Programming Part I 1 Motivations In the preceding chapter, you learned how to create, compile, and run a Java program. Starting from this chapter, you will learn how to solve practical
More informationLesson 04: Our First Java Program (W01D4
Lesson 04: Our First Java Program (W01D4) Balboa High School Michael Ferraro Lesson 04: Our First Java Program (W01D4 Do Now Start a terminal shell. From there, issue these commands
More informationCISC 370: Introduction to Java
CISC 370: Introduction to Java Instructor: Sara Sprenkle sprenkle@cis cis.udel.eduedu TA: Ke Li kli@cis cis.udel.eduedu 1 What is Java? and, why should I learn it? Sara Sprenkle - CISC370 2 What is Java?
More informationCOMP-202 Unit 2: Java Basics. CONTENTS: Using Expressions and Variables Types Strings
COMP-202 Unit 2: Java Basics CONTENTS: Using Expressions and Variables Types Strings Assignment 1 Assignment 1 posted on WebCt. It will be due January 21 st at 13:00 Worth 4% Last Class Input and Output
More informationLecture Set 2: Starting Java
Lecture Set 2: Starting Java 1. Java Concepts 2. Java Programming Basics 3. User output 4. Variables and types 5. Expressions 6. User input 7. Uninitialized Variables 0 This Course: Intro to Procedural
More informationChapter 2: Data and Expressions
Chapter 2: Data and Expressions CS 121 Department of Computer Science College of Engineering Boise State University April 21, 2015 Chapter 2: Data and Expressions CS 121 1 / 53 Chapter 2 Part 1: Data Types
More informationIntroduction to Java
Introduction to Java What Java is: A tool for programming well Portable across any hardware platform that has a JVM interpreter Relatively easy to learn if you have a good foundation An object-oriented
More informationCS 302: Introduction to Programming
CS 302: Introduction to Programming Lectures 2-3 CS302 Summer 2012 1 Review What is a computer? What is a computer program? Why do we have high-level programming languages? How does a high-level program
More informationData and Variables. Data Types Expressions. String Concatenation Variables Declaration Assignment Shorthand operators. Operators Precedence
Data and Variables Data Types Expressions Operators Precedence String Concatenation Variables Declaration Assignment Shorthand operators Review class All code in a java file is written in a class public
More informationSpace Exploration EECS /25
1/25 Space Exploration EECS 4315 www.eecs.yorku.ca/course/4315/ Nondeterminism 2/25 Nondeterministic code is code that, even for the same input, can exhibit different behaviours on different runs, as opposed
More informationGetting Started with Java. Atul Prakash
Getting Started with Java Atul Prakash Running Programs C++, Fortran, Pascal Python, PHP, Ruby, Perl Java is compiled into device-independent code and then interpreted Source code (.java) is compiled into
More informationLecture 2: Variables and Operators. AITI Nigeria Summer 2012 University of Lagos.
Lecture 2: Variables and Operators AITI Nigeria Summer 2012 University of Lagos. Agenda Variables Types Naming Assignment Data Types Type casting Operators Declaring Variables in Java type name; Variables
More information