: Primitive data types Variables Operators if, if-else do-while, while, for. // // First Java Program. public class Hello {

Size: px
Start display at page:

Download ": Primitive data types Variables Operators if, if-else do-while, while, for. // // First Java Program. public class Hello {"

Transcription

1 : Primitive data types Variables Operators if, if-else do-while, while, for /11/ // // First Java Program public class Hello { // // main method public static void main(string[] args) { System.out.print("Hello "); "); System.out.println(" "); // // end end of of class Hello /11/ // // First Java Program public class Hello { // // main method public static void main(string[] args) { System.out.print("Hello "); "); System.out.println(" "); // // end end of of class Hello JLab>javac Hello.java JLab>java Hello Hello JLab> Hello.java javac (compiler) Hello.class java (launcher) /11/2002 4

2 Source Codes, Byte Codes, Machine Codes Programmer source codes Java Compiler source code byte codes Java Launcher byte code Java Virtual Machine (JVM) JVM byte codes machine codes Java Programming Language The Java TM Language Specification : Second Ed. (James Gosling, Bill Joy, Guy Steele and Gilad Bracha) abstract assert boolean break byte case catch char class const continue default do double else extends final finally float for goto if implements import instanceof int interface long native new null package private protected public return short static strictfp super switch synchronized this throw throws transient try void volatile while /11/ /11/ Java Platform A platform is the hardware or software environment in which a program runs. Java Platform has two components : The Java Virtual Machine (Java VM) The Java Application Programming Interface (Java API) import java.util.arrays; public class A { public static void main(string[] args) { int[] data = new new int[10]; for for (int i = 0; 0; i < data.length; i++) { data[i] = (int) (100 * Math.random()); Arrays.sort(data, 0, 0, data.length); for for (int i = 0; 0; i < data.length; i++) { System.out.print(data[i] + " "); "); System.out.println(); /11/ /11/2002 8

3 Java APIs version #packages #classes ~ ~2800 Java Platform Editions Three editions of Java 2 Platform Standard Edition (J2SE) (client-side general-purpose applications) Enterprise Edition (J2EE) (multi-tier server-centric applications) Micro Edition (J2ME) (consumer and embedded devices) /11/ /11/ JRE and JSDK Java JRE : the Java Runtime Environment JVM : the Java virtual machine API : the Java platform core classes supporting files JSDK : the Java Software Development Kit the JRE development tools such as compilers and debuggers. The name is not an acronym, but rather a reminder of that hot, aromatic stuff that many programmers like to drink lots of. A slang term for coffee that dates back to the days when the best brews came from Indonesia, not Seattle. The Duke /11/ /11/

4 Object-oriented Cross platform : (Linux, Windows, Mac OS, ) Internationalization (i18n) Huge class libraries (APIs) Popularity etc. (network-oriented, automatic garbage collector, strong type checking, secure, many free development tools, ) ( (Sun One Studio, JBuilder,...) /11/ /11/ abstract assert boolean break byte case catch char class const continue default do double else extends final finally float for goto if implements import instanceof int interface long native new null package private protected public return short static strictfp super switch synchronized this throw throws transient try void volatile while object-oriented programming ( ) Java APIs (<5% ) graphics, network, database,... Java ( 1.4.1_01) JLab /11/ /11/

5 main method 8 : byte, short, int, long : float, double : char : boolean class String, Vector, /11/ /11/ (integer) () 1023, 76289, 0, 10, byte ( ) short ( ) int ( ) long ( ) int (real number) 102.0, , 0.0, -10.8, floating point x10 8, x10-5 float 6-9 ( -3.4x x x x10 38 ) double ( -1.8x x x x ) double /11/ /11/

6 (character) char Unicode (char ) (character) 'a', 'b', 'A', 'B', '', '', '', '', '1', '2', '', '', '#', '$', '', '' '\n' '\t' tab '\\' \ (backslash) '\'' ' (single quote) '\"' " (double quote) (String) String char "engineering" "webboy@universe.org" "" "Hello How are you" "" "1004" 1004 "" '' '' /11/ /11/ (boolean) boolean 1 0 int int counter = 0; 0; double radius = 5.225; boolean success = ; char char korkai = ''; ''; String name name = "somchai"; int int i = 100, 100, j = 200; 200; double x0, x0, y0, y0, z0; z0; double x1, x1, y1 y1 = 4.5, 4.5, z1 z1 = 7.8; 7.8; /11/ /11/

7 ; int int counter int int counter = 0.75; 0.75; double radius = "15.25"; boolean success = 1; 1; integer counter; double radius = "15.25"; string title title = WWW"; int int boolean; double public = 12.7; 12.7; String 12X 12X = WWW"; /11/ $ _ ( class ) int17 int17 buttercup Public int2string day_of_week 7zean 7zean I.love.you public ohoh! ohoh! ed-edd-n-eddy /11/ : class : _ $ "" (assignment) = + * / % numstudents dayofweek imagebuffer tvchannel customerid initialvelocity /11/ /11/

8 : () a++ a a ++a a int i=1, j=2, k; int i 1 int j 2 int k : () a-- a a --a a int i=10, j=4, k; int i 10 int j 4 int k i++; ++j; j = i++; k = ++j + i++; i--; --j; j = --i; k = --j - --i; k = j i; k = j i; /11/ /11/ double x=10.0, y=20.0, z; z; z = x++ x y; ++y; z = x-- x y; --y; compiler z = x++-++y; comma long l L () : 0 ( 0) : 0 : 0x z = x--+--y; z = x+++++y; z = x-----y; compiler int int base10 = 2545; 2545; int int base8 base8 = 04761; int int base16 = 0x9F1; long long base10 = 2545L; long long base8 base8 = 04761L; long long base16 = 0x9F1L; (x++)++; /11/ /11/

9 float f F double d D E7 ( 123 x 10 7 ) 12.3E8 ( 12.3 x 10 8 ) E11 ( 1.23 x ) E-6 ( -567 x 10-6 ) -5.67E-4 ( x 10-4 ) E-3 ( x 10-3 )... e /11/ double x = (1/2 (1/2 + 1/2); 1/2); x float float y = 1.0/2.0; y double z = 4d 4d + 5; 5; z double u = /2; 1/2; u double v = (0.0 ( )/2; 1)/2; v double f = 212.0; double c = (5/9) (5/9) * (f (f - 32); 32); c /11/ String String + + String + String + public class class StringConcatenation { public static void void main(string [] [] args) args) { String s1 s1 = "Approx. value value of of PI"; PI"; String s2 s2 = "is"; "is"; System.out.println(s1 + s2); s2); System.out.println(s1 + " " + s2); s2); System.out.println(s1 + " " + s2 s2 + " " + Math.PI); JLab>java StringConcatenation Approx. value of PIis Approx. value of PI is Approx. value of PI is JLab> /11/ : + "1 "1 + 2 = " ; + "1 + 2 = 1" tostring "1" + tostring "2.0" "1 + 2 = 12.0" /11/

10 : + Selection : if statement "1 "1 + 2 = " + (1 ( ); int to double 1.0 Boolean expr. do this tostring "3.0" if if ( Boolean expr ) { do do this ; "1 + 2 = 3.0" /11/ /11/ Selection : if-else statement Boolean expr. do this if do this if Relational Operators < () > () <= () >= () == ()!= () boolean if if ( Boolean expr ) { do do this if if ; else { do do this if if ; ( (n (n % 2) 2) == == 1 ) n n n = 1 n == == /11/ /11/

11 Boolean Operators Nested If && and or! not F A G H B J E C D if if ( A ) { if if ( B ) { E ; if if ( C ) { D ; else { G ; if if ( H ) { J ; else { F ; /11/ /11/ Short-circuiting Statement Block x!=0 y/x > 5 Z=1 if if (x (x!=!= 0) 0) { if if (y/x (y/x > 5) 5) { z = 1; 1; Block { if if (Boolean Expression) if if (Boolean Expression) a statement ; a statement ; else a statement ; if if (x (x!=!= 0 && && y/x y/x > 5) 5) { z = 1; 1; if if (y/x (y/x > 5 && && x!=!= 0) 0) { z = 1; 1; x == 0 y/x y/x x!= 0 Short-circuiting ( ) && expr expr expr expr if if (Boolean Expression){ statements ; if statement if if (Boolean Expression){ statements ; else { statements ; if-else statement /11/ /11/

12 == < > String if (x < 0) { x = -x; if (x < 0) { done = ; else { done = ; if (x < 0) x = -x; if (x < 0) done = ; else done = ; if (x < 0) x = -x; done = (x < 0); String methods equals compareto s1.equals(s2) = s1 s2 s1 s2 < 0 s1 s2 s1.compareto(s2) = 0 s1 s2 > 0 s1 s /11/ /11/ do-while while for do this Boolean expr. initialization condition Boolean expr. do this do this update do do { do do this while ( Boolean expr ); ); while ( Boolean expr ) { do do this for for ( initialization ; condition ; update ) { do do this /11/ /11/

13 block statement for for ( initialization ; condition ; update ) { statements for for ( initialization ; condition ; update ) statement ; do do { while ( Boolean expr ) { statements statements while ( Boolean expr ); ); do do while ( Boolean expr ) statement ; statement ; while ( Boolean expr ); ); break for ( int j=0, i=0; j<n; ++j ) { while ( i < n ) { break;... break; /11/ /11/ continue int i = 0; while (i < 7) { i++; System.out.println(i); if (i > 3) continue; System.out.println(i + 100); Requirement Analysis x k 1 Design Implementation 1 2 x k a x k /11/ /11/

14 a x k a x k+1 = (x k + a/x k )/2 a x k () a = 4.0 x 0 = 1.0 x 1 = 2.5 x 2 = 2.05 x 3 = x 4 = x 5 = x 6 = 2.0 a = x 0 = 1.0 x 1 = 50.5 x 2 = x 3 = x 4 = x 5 = x 6 = x 7 = x 8 = /11/ x k+1 = (x k + a/x k )/2 k = 1,2,3,... x 0 = 1 x k+1 x k x y ( double) x y max x, y ( ) /11/ y = 1.0 a x = y y = (x + a/x)/2 x y max x, y y /11/ import jlab.jlabio; public class Sqrt { public static void main(string[] args) { double x, x, y = 1.0; double a = JLabIO.readDouble("a = "); "); do do { x = y; y; y = (x (x + a / x) x) / 2.0; while ((Math.abs(x - y) y) / Math.max(Math.abs(x), Math.abs(y))) >= >= 1E-14); System.out.println("sqrt(" + a + ") ") = " + y); y); JLab>java JLab>java Sqrt Sqrt 339 x = 9E200 9E200 sqrt(9.0e200) sqrt(9.0e200) = 3.0E E100 JLab> JLab> /11/

Java language. Part 1. Java fundamentals. Yevhen Berkunskyi, NUoS

Java language. Part 1. Java fundamentals. Yevhen Berkunskyi, NUoS Java language Part 1. Java fundamentals Yevhen Berkunskyi, NUoS eugeny.berkunsky@gmail.com http://www.berkut.mk.ua What Java is? Programming language Platform: Hardware Software OS: Windows, Linux, Solaris,

More information

CSC 1214: Object-Oriented Programming

CSC 1214: Object-Oriented Programming CSC 1214: Object-Oriented Programming J. Kizito Makerere University e-mail: jkizito@cis.mak.ac.ug www: http://serval.ug/~jona materials: http://serval.ug/~jona/materials/csc1214 e-learning environment:

More information

DM550 / DM857 Introduction to Programming. Peter Schneider-Kamp

DM550 / DM857 Introduction to Programming. Peter Schneider-Kamp DM550 / DM857 Introduction to Programming Peter Schneider-Kamp petersk@imada.sdu.dk http://imada.sdu.dk/~petersk/dm550/ http://imada.sdu.dk/~petersk/dm857/ OBJECT-ORIENTED PROGRAMMING IN JAVA 2 Programming

More information

BIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic

BIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic BIT 3383 Java Programming Sem 1 Session 2011/12 Chapter 2 JAVA basic Objective: After this lesson, you should be able to: declare, initialize and use variables according to Java programming language guidelines

More information

An overview of Java, Data types and variables

An 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 information

Building Java Programs. Introduction to Programming and Simple Java Programs

Building Java Programs. Introduction to Programming and Simple Java Programs Building Java Programs Introduction to Programming and Simple Java Programs 1 A simple Java program public class Hello { public static void main(string[] args) { System.out.println("Hello, world!"); code

More information

3. Java - Language Constructs I

3. 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 information

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal

Expressions 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 information

Java Programming. Atul Prakash

Java 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 information

Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal

Expressions 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 information

Computer Components. Software{ User Programs. Operating System. Hardware

Computer 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 information

DM550 Introduction to Programming part 2. Jan Baumbach.

DM550 Introduction to Programming part 2. Jan Baumbach. DM550 Introduction to Programming part 2 Jan Baumbach jan.baumbach@imada.sdu.dk http://www.baumbachlab.net COURSE ORGANIZATION 2 Course Elements Lectures: 10 lectures Find schedule and class rooms in online

More information

CompSci 125 Lecture 02

CompSci 125 Lecture 02 Assignments CompSci 125 Lecture 02 Java and Java Programming with Eclipse! Homework:! http://coen.boisestate.edu/jconrad/compsci-125-homework! hw1 due Jan 28 (MW), 29 (TuTh)! Programming:! http://coen.boisestate.edu/jconrad/cs125-programming-assignments!

More information

Objectives. Problem Solving. Introduction. An overview of object-oriented concepts. Programming and programming languages An introduction to Java

Objectives. Problem Solving. Introduction. An overview of object-oriented concepts. Programming and programming languages An introduction to Java Introduction Objectives An overview of object-oriented concepts. Programming and programming languages An introduction to Java 1-2 Problem Solving The purpose of writing a program is to solve a problem

More information

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this

More information

Java is a high-level programming language originally developed by Sun Microsystems and released in Java runs on a variety of

Java is a high-level programming language originally developed by Sun Microsystems and released in Java runs on a variety of Java is a high-level programming language originally developed by Sun Microsystems and released in 1995. Java runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX.

More information

Java Programming Language Mr.Rungrote Phonkam

Java Programming Language Mr.Rungrote Phonkam 3 Java Programming Language Mr.Rungrote Phonkam rungrote@it.kmitl.ac.th Contents 1. Identify 2. Method Member 3. Literals 4. Data Type 6. Variable 1. Identify ก ก Class, Data, Method, Variable, Label,

More information

Lecture 2: Variables and Operators. AITI Nigeria Summer 2012 University of Lagos.

Lecture 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

Games Course, summer Introduction to Java. Frédéric Haziza

Games Course, summer Introduction to Java. Frédéric Haziza Games Course, summer 2005 Introduction to Java Frédéric Haziza (daz@it.uu.se) Summer 2005 1 Outline Where to get Java Compilation Notions of Type First Program Java Syntax Scope Class example Classpath

More information

DM503 Programming B. Peter Schneider-Kamp.

DM503 Programming B. Peter Schneider-Kamp. DM503 Programming B Peter Schneider-Kamp petersk@imada.sdu.dk! http://imada.sdu.dk/~petersk/dm503/! VARIABLES, EXPRESSIONS & STATEMENTS 2 Values and Types Values = basic data objects 42 23.0 "Hello!" Types

More information

2 rd class Department of Programming. OOP with Java Programming

2 rd class Department of Programming. OOP with Java Programming 1. Structured Programming and Object-Oriented Programming During the 1970s and into the 80s, the primary software engineering methodology was structured programming. The structured programming approach

More information

Getting started with Java

Getting 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 information

Course information. Petr Hnětynka 2/2 Zk/Z

Course information. Petr Hnětynka  2/2 Zk/Z JAVA Introduction Course information Petr Hnětynka hnetynka@d3s.mff.cuni.cz http://d3s.mff.cuni.cz/~hnetynka/java/ 2/2 Zk/Z exam written test zápočet practical test in the lab max 5 attempts zápočtový

More information

Lecture 1: Overview of Java

Lecture 1: Overview of Java 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 for easy Web/Internet applications Widespread

More information

COMP 202 Java in one week

COMP 202 Java in one week COMP 202 Java in one week... Continued CONTENTS: Return to material from previous lecture At-home programming exercises Please Do Ask Questions It's perfectly normal not to understand everything Most of

More information

Java TM Introduction. Renaud Florquin Isabelle Leclercq. FloConsult SPRL.

Java TM Introduction. Renaud Florquin Isabelle Leclercq. FloConsult SPRL. Java TM Introduction Renaud Florquin Isabelle Leclercq FloConsult SPRL http://www.floconsult.be mailto:info@floconsult.be Java Technical Virtues Write once, run anywhere Get started quickly Write less

More information

Java: framework overview and in-the-small features

Java: framework overview and in-the-small features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer Java: framework overview and in-the-small features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer

More information

Introduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview

Introduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview Introduction to Visual Basic and Visual C++ Introduction to Java Lesson 13 Overview I154-1-A A @ Peter Lo 2010 1 I154-1-A A @ Peter Lo 2010 2 Overview JDK Editions Before you can write and run the simple

More information

Chapter. Focus of the Course. Object-Oriented Software Development. program design, implementation, and testing

Chapter. Focus of the Course. Object-Oriented Software Development. program design, implementation, and testing Introduction 1 Chapter 5 TH EDITION Lewis & Loftus java Software Solutions Foundations of Program Design 2007 Pearson Addison-Wesley. All rights reserved Focus of the Course Object-Oriented Software Development

More information

Tony Valderrama, SIPB IAP 2009

Tony Valderrama, SIPB IAP 2009 Wake up and smell the coffee! Software Java Development Kit (JDK) - http://java.sun.com/javase/downloads/index.jsp Eclipse Platform - http://www.eclipse.org/ Reference The Java Tutorial - http://java.sun.com/docs/books/tutorial/index.html

More information

Computer Components. Software{ User Programs. Operating System. Hardware

Computer 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 information

Accelerating Information Technology Innovation

Accelerating Information Technology Innovation Accelerating Information Technology Innovation http://aiti.mit.edu Cali, Colombia Summer 2012 Lesson 02 Variables and Operators Agenda Variables Types Naming Assignment Data Types Type casting Operators

More information

Course information. Petr Hnětynka 2/2 Zk/Z

Course information. Petr Hnětynka  2/2 Zk/Z JAVA Introduction Course information Petr Hnětynka hnetynka@d3s.mff.cuni.cz http://d3s.mff.cuni.cz/~hnetynka/java/ 2/2 Zk/Z exam written test zápočet practical test in the lab zápočtový program "reasonable"

More information

Java Programming Language Mr.Rungrote Phonkam

Java Programming Language Mr.Rungrote Phonkam 2 Java Programming Language Mr.Rungrote Phonkam rungrote@it.kmitl.ac.th Contents 1. Intro to Java. 2. Java Platform 3. Java Language 4. JDK 5. Programming Steps 6. Visual Programming 7. Basic Programming

More information

Welcome to CSE 142! Zorah Fung University of Washington, Spring Building Java Programs Chapter 1 Lecture 1: Introduction; Basic Java Programs

Welcome to CSE 142! Zorah Fung University of Washington, Spring Building Java Programs Chapter 1 Lecture 1: Introduction; Basic Java Programs Welcome to CSE 142! Zorah Fung University of Washington, Spring 2015 Building Java Programs Chapter 1 Lecture 1: Introduction; Basic Java Programs reading: 1.1-1.3 1 What is computer science? computers?

More information

II. Compiling and launching from Command-Line, IDE A simple JAVA program

II. Compiling and launching from Command-Line, IDE A simple JAVA program Contents Topic 01 - Java Fundamentals I. Introducing JAVA II. Compiling and launching from Command-Line, IDE A simple JAVA program III. How does JAVA work IV. Review - Programming Style, Documentation,

More information

CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY JAVA

CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY JAVA 1. JIT meaning a. java in time b. just in time c. join in time d. none of above CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY JAVA 2. After the compilation of the java source code, which file is created

More information

CS5000: Foundations of Programming. Mingon Kang, PhD Computer Science, Kennesaw State University

CS5000: 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 information

Fundamentals of Programming. By Budditha Hettige

Fundamentals of Programming. By Budditha Hettige Fundamentals of Programming By Budditha Hettige Overview Exercises (Previous Lesson) The JAVA Programming Languages Java Virtual Machine Characteristics What is a class? JAVA Standards JAVA Keywords How

More information

5/3/2006. Today! HelloWorld in BlueJ. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont.

5/3/2006. Today! HelloWorld in BlueJ. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. Today! Build HelloWorld yourself in BlueJ and Eclipse. Look at all the Java keywords. Primitive Types. HelloWorld in BlueJ 1. Find BlueJ in the start menu, but start the Select VM program instead (you

More information

Tools : The Java Compiler. The Java Interpreter. The Java Debugger

Tools : 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 information

CS 11 java track: lecture 1

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 information

Program Fundamentals

Program 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 information

Introduction to Programming (Java) 2/12

Introduction to Programming (Java) 2/12 Introduction to Programming (Java) 2/12 Michal Krátký Department of Computer Science Technical University of Ostrava Introduction to Programming (Java) 2008/2009 c 2006 2008 Michal Krátký Introduction

More information

Last Time. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu. Readings

Last Time. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu. Readings University of British Columbia CPSC 111, Intro to Computation Alan J. Hu Writing a Simple Java Program Intro to Variables Readings Your textbook is Big Java (3rd Ed). This Week s Reading: Ch 2.1-2.5, Ch

More information

Tony Valderrama, SIPB IAP 2010

Tony Valderrama, SIPB IAP 2010 Overview Getting started Background Syntax Announcements Course website: http://sipb.mit.edu/iap/java/ Email: sipb-iap-java@mit.edu Notes and code samples have been posted on the website. I need suggestions

More information

Advanced Programming Introduction

Advanced Programming Introduction Advanced Programming Introduction Course Description The Goal The Motivation Lectures and Assignments Programming Platform Resources Evaluation Lab: problems, projects, essays easy Exam: written test hard

More information

Learning objectives. The Java Environment. Java timeline (cont d) Java timeline. Understand the basic features of Java

Learning objectives. The Java Environment. Java timeline (cont d) Java timeline. Understand the basic features of Java Learning objectives The Java Environment Understand the basic features of Java What are portability and robustness? Understand the concepts of bytecode and interpreter What is the JVM? Learn few coding

More information

Expressions and Data Types CSC 121 Spring 2017 Howard Rosenthal

Expressions 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 information

3. Java - Language Constructs I

3. Java - Language Constructs I Names and Identifiers A program (that is, a class) needs a name public class SudokuSolver {... 3. Java - Language Constructs I Names and Identifiers, Variables, Assignments, Constants, Datatypes, Operations,

More information

History Introduction to Java Characteristics of Java Data types

History Introduction to Java Characteristics of Java Data types Course Name: Advanced Java Lecture 1 Topics to be covered History Introduction to Java Characteristics of Java Data types What is Java? An Object-Oriented Programming Language developed at Sun Microsystems

More information

Java Identifiers. Java Language Essentials. Java Keywords. Java Applications have Class. Slide Set 2: Java Essentials. Copyright 2012 R.M.

Java Identifiers. Java Language Essentials. Java Keywords. Java Applications have Class. Slide Set 2: Java Essentials. Copyright 2012 R.M. Java Language Essentials Java is Case Sensitive All Keywords are lower case White space characters are ignored Spaces, tabs, new lines Java statements must end with a semicolon ; Compound statements use

More information

Crash Course in Java. Why Java? Java notes for C++ programmers. Network Programming in Java is very different than in C/C++

Crash Course in Java. Why Java? Java notes for C++ programmers. Network Programming in Java is very different than in C/C++ Crash Course in Java Netprog: Java Intro 1 Why Java? Network Programming in Java is very different than in C/C++ much more language support error handling no pointers! (garbage collection) Threads are

More information

Welcome to CSE 142! Whitaker Brand. University of Washington, Winter 2018

Welcome to CSE 142! Whitaker Brand. University of Washington, Winter 2018 Welcome to CSE 142! Whitaker Brand University of Washington, Winter 2018 1 What is computer science? computers? science? programming? late lonely nights in front of the computer? ALGORITHMIC THINKING al

More information

Goals. Java - An Introduction. Java is Compiled and Interpreted. Architecture Neutral & Portable. Compiled Languages. Introduction to Java

Goals. 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 information

Outline. Overview. Control statements. Classes and methods. history and advantage how to: program, compile and execute 8 data types 3 types of errors

Outline. 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 information

1. Introduction. Java. Fall 2009 Instructor: Dr. Masoud Yaghini

1. Introduction. Java. Fall 2009 Instructor: Dr. Masoud Yaghini 1. Introduction Java Fall 2009 Instructor: Dr. Masoud Yaghini Outline Introduction Introduction The Java Programming Language The Java Platform References Java technology Java is A high-level programming

More information

Imports. Lexicon. Java/Lespérance 1. PROF. Y. LESPÉRANCE Dept. of Electrical Engineering & Computer Science

Imports. Lexicon. Java/Lespérance 1. PROF. Y. LESPÉRANCE Dept. of Electrical Engineering & Computer Science Lexicon CS1022 MOBIL COMPUTING PROF Y LSPÉRANC Dept of lectrical ngineering & Computer Science 1 2 Imports 3 Imported Class = DelegaKon 4 Java/Lespérance 1 Lexicon Class Header Class Body, a Block import

More information

Language Fundamentals Summary

Language Fundamentals Summary Language Fundamentals Summary Claudia Niederée, Joachim W. Schmidt, Michael Skusa Software Systems Institute Object-oriented Analysis and Design 1999/2000 c.niederee@tu-harburg.de http://www.sts.tu-harburg.de

More information

COT 3530: Data Structures. Giri Narasimhan. ECS 389; Phone: x3748

COT 3530: Data Structures. Giri Narasimhan. ECS 389; Phone: x3748 COT 3530: Data Structures Giri Narasimhan ECS 389; Phone: x3748 giri@cs.fiu.edu www.cs.fiu.edu/~giri/teach/3530spring04.html Evaluation Midterm & Final Exams Programming Assignments Class Participation

More information

B.V. Patel Institute of BMC & IT, UTU 2014

B.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 information

Chapter 2. Elementary Programming

Chapter 2. Elementary Programming Chapter 2 Elementary Programming 1 Objectives To write Java programs to perform simple calculations To obtain input from the console using the Scanner class To use identifiers to name variables, constants,

More information

Lec 3. Compilers, Debugging, Hello World, and Variables

Lec 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 information

Chapter 1 Introduction to Computers, Programs, and Java. What is a Computer? A Bit of History

Chapter 1 Introduction to Computers, Programs, and Java. What is a Computer? A Bit of History Chapter 1 Introduction to Computers, Programs, and Java CS170 Introduction to Computer Science 1 What is a Computer? A machine that manipulates data according to a list of instructions Consists of hardware

More information

ECE 122 Engineering Problem Solving with Java

ECE 122 Engineering Problem Solving with Java ECE 122 Engineering Problem Solving with Java Introduction to Programming for ECE Lecture 1 Course Overview Welcome! What is this class about? Java programming somewhat software somewhat Solving engineering

More information

STRUCTURING OF PROGRAM

STRUCTURING OF PROGRAM Unit III MULTIPLE CHOICE QUESTIONS 1. Which of the following is the functionality of Data Abstraction? (a) Reduce Complexity (c) Parallelism Unit III 3.1 (b) Binds together code and data (d) None of the

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

Building Java Programs. Chapter 1: Introduction to Java Programming

Building Java Programs. Chapter 1: Introduction to Java Programming Building Java Programs Chapter 1: Introduction to Java Programming Lecture outline Introduction Syllabus and policies What is computer science Programs and programming languages Basic Java programs Output

More information

The Java Language The Java Language Reference (2 nd ed.) is the defining document for the Java language. Most beginning programming students expect

The Java Language The Java Language Reference (2 nd ed.) is the defining document for the Java language. Most beginning programming students expect The Java Language The Java Language Reference (2 nd ed.) is the defining document for the Java language. Most beginning programming students expect such a document to be totally beyond them. That expectation

More information

Programming. Syntax and Semantics

Programming. Syntax and Semantics Programming For the next ten weeks you will learn basic programming principles There is much more to programming than knowing a programming language When programming you need to use a tool, in this case

More information

Praktische Softwaretechnologie

Praktische Softwaretechnologie Praktische Softwaretechnologie Lecture 2. Károly Bósa () Research Institute for Symbolic Computation (RISC) 1 Books James Gosling, Bill Joy, Guy Steele The JavaTM Language Specification 2 Books James Gosling,

More information

PROGRAMMING FUNDAMENTALS

PROGRAMMING 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 information

History of Java. Java was originally developed by Sun Microsystems star:ng in This language was ini:ally called Oak Renamed Java in 1995

History of Java. Java was originally developed by Sun Microsystems star:ng in This language was ini:ally called Oak Renamed Java in 1995 Java Introduc)on History of Java Java was originally developed by Sun Microsystems star:ng in 1991 James Gosling Patrick Naughton Chris Warth Ed Frank Mike Sheridan This language was ini:ally called Oak

More information

CS/B.TECH/CSE(OLD)/SEM-6/CS-605/2012 OBJECT ORIENTED PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70

CS/B.TECH/CSE(OLD)/SEM-6/CS-605/2012 OBJECT ORIENTED PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70 CS/B.TECH/CSE(OLD)/SEM-6/CS-605/2012 2012 OBJECT ORIENTED PROGRAMMING Time Allotted : 3 Hours Full Marks : 70 The figures in the margin indicate full marks. Candidates are required to give their answers

More information

A web-based IDE for Java

A web-based IDE for Java A web-based IDE for Java Software Engineering Laboratory By: Supervised by: Marcel Bertsch Christian Estler Dr. Martin Nordio Prof. Dr. Bertrand Meyer Student Number: 09-928-896 Content 1 Introduction...3

More information

1 Shyam sir JAVA Notes

1 Shyam sir JAVA Notes 1 Shyam sir JAVA Notes 1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write

More information

DM550 Introduction to Programming part 2. Jan Baumbach.

DM550 Introduction to Programming part 2. Jan Baumbach. DM550 Introduction to Programming part 2 Jan Baumbach jan.baumbach@imada.sdu.dk http://www.baumbachlab.net VARIABLES, EXPRESSIONS & STATEMENTS 2 Values and Types Values = basic data objects 42 23.0 "Hello!"

More information

Pace University. Fundamental Concepts of CS121 1

Pace University. Fundamental Concepts of CS121 1 Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction

More information

JOSE LUIS JUAREZ VIVEROS com) has a. non-transferable license to use this Student Guide

JOSE LUIS JUAREZ VIVEROS com) has a. non-transferable license to use this Student Guide Module 3 Identifiers, Keywords, and Types Objectives Upon completion of this module, you should be able to: Use comments in a source program Distinguish between valid and invalid identifiers Recognize

More information

Introduction to Java

Introduction to Java Introduction to Java Module 1: Getting started, Java Basics 22/01/2010 Prepared by Chris Panayiotou for EPL 233 1 Lab Objectives o Objective: Learn how to write, compile and execute HelloWorld.java Learn

More information

Java Basic Programming Constructs

Java 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 information

Introduction to Java https://tinyurl.com/y7bvpa9z

Introduction 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 information

Selected Questions from by Nageshwara Rao

Selected Questions from  by Nageshwara Rao Selected Questions from http://way2java.com by Nageshwara Rao Swaminathan J Amrita University swaminathanj@am.amrita.edu November 24, 2016 Swaminathan J (Amrita University) way2java.com (Nageshwara Rao)

More information

JAVA Ch. 4. Variables and Constants Lawrenceville Press

JAVA Ch. 4. Variables and Constants Lawrenceville Press JAVA Ch. 4 Variables and Constants Slide 1 Slide 2 Warm up/introduction int A = 13; int B = 23; int C; C = A+B; System.out.print( The answer is +C); Slide 3 Declaring and using variables Slide 4 Declaring

More information

CISC 370: Introduction to Java

CISC 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 information

Entering the world of Javatar

Entering the world of Javatar Entering the world of Javatar Subset of the Supplement Lesson slides from: Building Java Programs by Stuart Reges and Marty Stepp (http://www.buildingjavaprograms.com/ ) Compiling/running programs 1. Write

More information

Certified Core Java Developer VS-1036

Certified Core Java Developer VS-1036 VS-1036 1. LANGUAGE FUNDAMENTALS The Java language's programming paradigm is implementation and improvement of Object Oriented Programming (OOP) concepts. The Java language has its own rules, syntax, structure

More information

Lesson 01 Introduction

Lesson 01 Introduction Lesson 01 Introduction MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz Lecturer in Management & IT M.Sc. In IS (SLIIT), PGD in IS (SLIIT), BBA (Hons.) Spl. in IS (SEUSL), MCP Programs Computer

More information

Week 6: Review. Java is Case Sensitive

Week 6: Review. Java is Case Sensitive Week 6: Review Java Language Elements: special characters, reserved keywords, variables, operators & expressions, syntax, objects, scoping, Robot world 7 will be used on the midterm. Java is Case Sensitive

More information

Core Java Syllabus. Overview

Core Java Syllabus. Overview Core Java Syllabus Overview Java programming language was originally developed by Sun Microsystems which was initiated by James Gosling and released in 1995 as core component of Sun Microsystems' Java

More information

Interpreted vs Compiled. Java Compile. Classes, Objects, and Methods. Hello World 10/6/2016. Python Interpreted. Java Compiled

Interpreted 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 information

1.Which four options describe the correct default values for array elements of the types indicated?

1.Which four options describe the correct default values for array elements of the types indicated? 1.Which four options describe the correct default values for array elements of the types indicated? 1. int -> 0 2. String -> "null" 3. Dog -> null 4. char -> '\u0000' 5. float -> 0.0f 6. boolean -> true

More information

CS11 Java. Fall Lecture 1

CS11 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 information

The Sun s Java Certification and its Possible Role in the Joint Teaching Material

The Sun s Java Certification and its Possible Role in the Joint Teaching Material The Sun s Java Certification and its Possible Role in the Joint Teaching Material Nataša Ibrajter Faculty of Science Department of Mathematics and Informatics Novi Sad 1 Contents Kinds of Sun Certified

More information

CHAPTER 1. Introduction to JAVA Programming

CHAPTER 1. Introduction to JAVA Programming CHAPTER 1 Introduction to JAVA Programming What java is Java is high level You can use java to write computer applications that computes number,process words,play games,store data, etc. History of Java.

More information

Software Practice 1 Basic Grammar

Software Practice 1 Basic Grammar Software Practice 1 Basic Grammar Basic Syntax Data Type Loop Control Making Decision Prof. Joonwon Lee T.A. Jaehyun Song Jongseok Kim (42) T.A. Sujin Oh Junseong Lee (43) 1 2 Java Program //package details

More information

Lecture 1: Basic Java Syntax

Lecture 1: Basic Java Syntax Lecture 1: Basic Java Syntax Building Java Programs: A Back to Basics Approach by Stuart Reges and Marty Stepp Copyright (c) Pearson 2013. All rights reserved. Java Terminology class: (a) A module or program

More information

Programming in C++ 4. The lexical basis of C++

Programming in C++ 4. The lexical basis of C++ Programming in C++ 4. The lexical basis of C++! Characters and tokens! Permissible characters! Comments & white spaces! Identifiers! Keywords! Constants! Operators! Summary 1 Characters and tokens A C++

More information

The MaSH Programming Language At the Statements Level

The MaSH Programming Language At the Statements Level The MaSH Programming Language At the Statements Level Andrew Rock School of Information and Communication Technology Griffith University Nathan, Queensland, 4111, Australia a.rock@griffith.edu.au June

More information

1. Java is a... language. A. moderate typed B. strogly typed C. weakly typed D. none of these. Answer: B

1. Java is a... language. A. moderate typed B. strogly typed C. weakly typed D. none of these. Answer: B 1. Java is a... language. A. moderate typed B. strogly typed C. weakly typed D. none of these 2. How many primitive data types are there in Java? A. 5 B. 6 C. 7 D. 8 3. In Java byte, short, int and long

More information