Topics introduced today (these topics would be covered in more detail in later classes) – Primitive Data types Variables Methods “for” loop “if-else” statement.

Slides:



Advertisements
Similar presentations
AP Computer Science Anthony Keen. Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to.
Advertisements

Introduction to Java 2 Programming
STRING AN EXAMPLE OF REFERENCE DATA TYPE. 2 Primitive Data Types  The eight Java primitive data types are:  byte  short  int  long  float  double.
IT 325 OPERATING SYSTEM C programming language. Why use C instead of Java Intermediate-level language:  Low-level features like bit operations  High-level.
Air Force Institute of Technology Electrical and Computer Engineering
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,
5/17/ Programming Constructs... There are several types of programming constructs in JAVA. - If-else construct or ternary operator - while - do-while.
Java Syntax Part I Comments Identifiers Primitive Data Types Assignment.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall Office hours: M-F 11:00-11:
©2004 Brooks/Cole Chapter 2 Variables, Values and Operations.
Primitive Variable types Basic types –char (single character or ASCII integer value) –int (integer) –short (not longer than int) –long (longer than int)
(c) 2003 E.S.Boese1 Conditionals Chapter 10 - Student.
Java Syntax Primitive data types Operators Control statements.
Some basic I/O.
Primitive Types Java supports two kinds of types of values – objects, and – values of primitive data types variables store – either references to objects.
An Introduction to C Programming Geb Thomas. Learning Objectives Learn how to write and compile a C program Learn what C libraries are Understand the.
2015/8/221 Data Types & Operators Lecture from (Chapter 3,4)
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.
Object Oriented Design: Identifying Objects
By Nicholas Policelli An Introduction to Java. Basic Program Structure public class ClassName { public static void main(String[] args) { program statements.
CS 11 java track: lecture 1 Administrivia need a CS cluster account cgi-bin/sysadmin/account_request.cgi need to know UNIX
CS591x A very brief introduction to Java. Java Developed by Sun Microsystems was intended a language for embedded applications became a general purpose.
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 Simple Types CSIS 3701: Advanced Object Oriented Programming.
Primitive Variables.
Objects, Classes and Syntax Dr. Andrew Wallace PhD BEng(hons) EurIng
An Introduction to Java – Part 1 Dylan Boltz. What is Java?  An object-oriented programming language  Developed and released by Sun in 1995  Designed.
Introduction to Java Lecture Notes 3. Variables l A variable is a name for a location in memory used to hold a value. In Java data declaration is identical.
Assignment An assignment statement changes the value of a variable The assignment operator is the = sign total = 55; Copyright © 2012 Pearson Education,
Java Programming Java Basics. Data Types Java has two main categories of data types: –Primitive data types Built in data types Many very similar to C++
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Copyright Curt Hill Variables What are they? Why do we need them?
Basics and arrays Operators:  Arithmetic: +, -, *, /, %  Relational:, >=, ==, !=  Logical: &&, ||, ! Primitive data types Byte(8), short(16), int(32),
Java Programming, Second Edition Chapter Two Using Data Within a Program.
Final Jeopardy Fundamen tal Java Numerical Data type Boolean Expressi on If/THEN/ WHILE Miscellan eous
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
Java Nuts and Bolts Variables and Data Types Operators Expressions Control Flow Statements Arrays and Strings.
 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.
1.2 Primitive Data Types and Variables
Chapter 1 Java Programming Review. Introduction Java is platform-independent, meaning that you can write a program once and run it anywhere. Java programs.
Primitive Data Types 1 In PowerPoint, point at the speaker icon, then click the "Play" button.
Test Review. General Info. All tests will be comprehensive. You will be tested more on your understanding of code as opposed to your ability to write.
A Introduction to Computing II Lecture 1: Java Review Fall Session 2000.
A data type in a programming language is a set of data with values having predefined characteristics.data The language usually specifies:  the range.
CPSC 233 Tutorial 5 February 9 th /10 th, Java Classes Each Java class contains a set of instance variables and methods Instance Variables: Type.
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.
JAVA Programming (Session 2) “When you are willing to make sacrifices for a great cause, you will never be alone.” Instructor: รัฐภูมิ เถื่อนถนอม
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.
Object Oriented Programming Lecture 2: BallWorld.
CPSC 233 Tutorial January 21 st /22 nd, Linux Commands.
Fundamentals 2.
Objects as a programming concept
CIS3931 – Intro to JAVA Lecture Note Set 2 17-May-05.
Selenium WebDriver Web Test Tool Training
Agenda Warmup Lesson 2.5 (Ascii, Method Overloading)
Variables Store information needed by the program Must have a TYPE
Unit-2 Objects and Classes
Computers & Programming Languages
An Introduction to Java – Part I, language basics
Lecture Notes – Week 3 Lecture-2
Chapter 2: Java Fundamentals
Recap Week 2 and 3.
Programs and Classes A program is made up from classes
Java Programming Review 1
Names of variables, functions, classes
Comparing Python and Java
Presentation transcript:

Topics introduced today (these topics would be covered in more detail in later classes) – Primitive Data types Variables Methods “for” loop “if-else” statement Introduce “String” object Exercise 1 would be posted

Primitive data types in Java: byte (8 bits) short (16 bits) int (32 bits) long (64 bits) float (32 bit single precision) double (64 bit double precision) boolean (true/false value) char (16 bit Unicode character)

Examples of variable declaration(initialization is optional): boolean result = true; char capitalC = 'C'; byte b = 100; short s = 10000; int i = ;

Method declaration has 6 components modifier (public/private) return type method name parameter list exception list( will be discussed later ) method body

Example for method declaration: public int add(int a, int b) { return a+b; }

The ‘for’ loop: for( ; ; increment) { //program statements. }

If-then statement: if( ) { //program statements. } else { //program statements. }

If-then-else statement: if( ) { //program statements. } else if( ) { //program statements. } else { //program statements. }

‘String’ – the string class represents character strings. String str = “abc”; String str = new(“abc”);