COP2800 – Computer Programming Using JAVA University of Florida Department of CISE Spring 2013 Lecture 06 – Java Datatypes Webpage: www.cise.ufl.edu/~mssz/JavaNM/Top-Level.html.

Slides:



Advertisements
Similar presentations
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 3: Flow Control I: For Loops.
Advertisements

STRING AN EXAMPLE OF REFERENCE DATA TYPE. 2 Primitive Data Types  The eight Java primitive data types are:  byte  short  int  long  float  double.
COP2800 – Computer Programming Using JAVA University of Florida Department of CISE Spring 2013 Lecture 09 – Programming with Java Datatypes and Flow Control.
1 © 1998, 2001, 2002Calvin College, Keith Vander Linden, Jeremy D. Frens, Larry R. Nyhoff Objects (Chap. 2) Variables and Constants.
Primitive Data Types There are a number of common objects we encounter and are treated specially by almost any programming language These are called basic.
Constants and Data Types Constants Data Types Reading for this class: L&L,
Types and Variables. Computer Programming 2 C++ in one page!
©2004 Brooks/Cole Chapter 2 Variables, Values and Operations.
CMT Programming Software Applications
COMS W1004 Introduction to Computer Science June 1, 2009.
Chapter 2 Data Types, Declarations, and Displays
Programming Principles Data types and Variables. Data types Variables are nothing but reserved memory locations to store values. This means that when.
Introduction to Programming Prof. Rommel Anthony Palomino Department of Computer Science and Information Technology Spring 2011.
Java Building Elements Lecture 2 Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University
CSCI 1100/1202 January 16, Why do we need variables? To store intermediate results in a long computation. To store a value that is used more than.
Java Primitives The Smallest Building Blocks of the Language (corresponds with Chapter 2)
COP2800 – Computer Programming Using JAVA University of Florida Department of CISE Spring 2013 Lecture 13 – Having Fun with Arrays in Java Webpage:
1 Please switch off your mobile phones. 2 Data Representation Instructor: Mainak Chaudhuri
Lecture 2 Object Oriented Programming Basics of Java Language MBY.
JAVA Tokens. Introduction A token is an individual element in a program. More than one token can appear in a single line separated by white spaces.
Java means Coffee Java Coffee Beans The name “JAVA” was taken from a cup of coffee.
Lec 6 Data types. Variable: Its data object that is defined and named by the programmer explicitly in a program. Data Types: It’s a class of Dos together.
 JAVA Compilation and Interpretation  JAVA Platform Independence  Building First JAVA Program  Escapes Sequences  Display text with printf  Data.
Lecture #5 Introduction to C++
COP2800 – Computer Programming Using JAVA University of Florida Department of CISE Spring 2013 Lecture 10 – Programming with Java Datatypes Type Casting.
Java Simple Types CSIS 3701: Advanced Object Oriented Programming.
COP2800 – Computer Programming Using JAVA University of Florida Department of CISE Spring 2013 Lecture 35 – Overview of Java Web Programming Webpage:
An Introduction to Java – Part 1 Dylan Boltz. What is Java?  An object-oriented programming language  Developed and released by Sun in 1995  Designed.
Assignment An assignment statement changes the value of a variable The assignment operator is the = sign total = 55; Copyright © 2012 Pearson Education,
ISBN Chapter 6 Data Types Introduction Primitive Data Types User-Defined Ordinal Types.
Copyright Curt Hill Variables What are they? Why do we need them?
COP2800 – Computer Programming Using JAVA University of Florida Department of CISE Spring 2013 Lecture 11 – How to Get Started on Assignment #2 Webpage:
Java Programming, Second Edition Chapter Two Using Data Within a Program.
COMP Primitive and Class Types Yi Hong May 14, 2015.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
CSI 3125, Preliminaries, page 1 Data Type, Variables.
Module B - Computation1/61 Module-B-Computation Variables Basic Memory Operations Expressions.
1.2 Primitive Data Types and Variables
Chapter One Lesson Three DATA TYPES ©
COP2800 – Computer Programming Using JAVA University of Florida Department of CISE Spring 2013 Lecture 20 – Inheritance and Polymorphism in Java Webpage:
Java – Variables and Constants By: Dan Lunney. Declaring Variables All variables must be declared before they can be used A declaration takes the form:
Types Chapter 2. C++ An Introduction to Computing, 3rd ed. 2 Objectives Observe types provided by C++ Literals of these types Explain syntax rules for.
Types Chapter 2. C++ An Introduction to Computing, 3rd ed. 2 Objectives Observe types provided by C++ Literals of these types Explain syntax rules for.
 Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. 
COP2800 – Computer Programming Using JAVA University of Florida Department of CISE Spring 2013 Lecture 39 – Command Line Args & Recursion Webpage:
WELCOME To ESC101N: Fundamentals of Computing Instructor: Ajai Jain
A data type in a programming language is a set of data with values having predefined characteristics.data The language usually specifies:  the range.
Java Basics. Tokens: 1.Keywords int test12 = 10, i; int TEst12 = 20; Int keyword is used to declare integer variables All Key words are lower case java.
Data Types References:  Data Type:  In computer science and computer programming, a data type or simply type is a.
 Data Type is a basic classification which identifies different types of data.  Data Types helps in: › Determining the possible values of a variable.
COP2800 – Computer Programming Using JAVA University of Florida Department of CISE Spring 2013 Lecture 14 – How to Complete Assignment 2, Part III Webpage:
1 Lecture # 2. * Introducing Programming with an Example * Identifiers, Variables, and Constants * Primitive Data Types * Byte, short, int, long, float,
Basic Data Types อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา Chapter 4.
COP2800 – Computer Programming Using JAVA University of Florida Department of CISE Spring 2013 Lecture 08 – Hand-On Work: Assignment 1, Part III Webpage:
Chapter 2 Variables and Constants. Objectives Explain the different integer variable types used in C++. Declare, name, and initialize variables. Use character.
Fundamentals 2.
CIS3931 – Intro to JAVA Lecture Note Set 2 17-May-05.
COP2800 – Computer Programming Using JAVA
Chapter 6: Data Types Lectures # 10.
EPSII 59:006 Spring 2004.
Multiple variables can be created in one declaration
Chapter 2.
Principles of Computer Programming (using Java) Chapter 2, Part 1
Unit-2 Objects and Classes
Computers & Programming Languages
An Introduction to Java – Part I, language basics
Chapter 2: Java Fundamentals
Unit 6 - Variables - Fundamental Data Types
Java Basics Data Types in Java.
Presentation transcript:

COP2800 – Computer Programming Using JAVA University of Florida Department of CISE Spring 2013 Lecture 06 – Java Datatypes Webpage:

COP2800 – Programming in JAVA Course Objectives – Basic Knowledge of Computers & Programming – Specific Knowledge of JAVA Programming – Practical Programming Projects Build Skills Today’s Class – Review of Java Datatypes – Datatypes For Assignment #1 float int

Review: Java Program Structure HIGH-LEVEL VIEW JAVA Units: -Packages -Classes (Instances) -Methods -Instructions -Variables PICTURE CREDIT:

Review: Java Package Structure PICTURE CREDIT:

New: Java Datatypes A datatype is a way of specifying the value of a variable x determines what actions can be performed on x sometimes varies with the programming language Java variables are statically typed – datatype must be declared before the variable can be used have datatype declarations using special words Example: byte, short, int, long, float, boolean, char, (string in the Java String class)

Java Datatypes (cont’d) An int (integer) is a 32-bit signed twos-complement integer specified by int descriptor (reserved word) Example: int i = 10; A float (single-precision floating-point number) is a positive or negative decimal number specified by float descriptor (reserved word) Example: float x = ; Usage Danger: F2C(-22.9f)

Java Datatypes (cont’d) A short (integer) is a 16-bit signed twos-complement integer specified by short descriptor (reserved word) Example: short i, j; A long (integer) is a 64-bit signed twos-complement integer specified by long descriptor (reserved word) Example: long j = L; (Java compiler would convert this number to long)

Java Datatypes (cont’d) A double (double-precision floating point number) is a 64-bit IEEE 754 format decimal number specified by double descriptor (reserved word) Example: double y = 1.4e-32; Usage Danger: function_name(-22.9e-47d) A boolean (logical value) has value true or false specified by boolean descriptor (reserved word) Example: boolean x = true;

Java Datatypes (cont’d) A char (character) is a 16-bit Unicode representation of a symbol specified by char descriptor (reserved word) Example: char c = \u0B17; char d = ‘e’ A byte (integer) is an 8-bit signed twos-complement integer specified by byte descriptor (reserved word) Example: byte k = -27;

This Week: Java Program Design Next Class (Friday) Build a Java Superclass TemperatureConverter Make a Subclass “F2C” and develop method You will Develop Class & Method for “C2F” Work on Programming Project #1, Part III Look-Ahead (Monday) Fun with Java Datatypes Programming with Datatypes & Flow Control