Week 1 - Friday.  What did we talk about last time?  Our first Java program.

Slides:



Advertisements
Similar presentations
Lecture 0 CSIS10A Overview. Welcome to CSIS10A (5 mins) – Typical format for class meetings New material first (monitors off, notebooks out) Practice.
Advertisements

IT151: Introduction to Programming
JAVA BASICS SYNTAX, ERRORS, AND DEBUGGING. OBJECTIVES FOR THIS UNIT Upon completion of this unit, you should be able to: Explain the Java virtual machine.
JAVA BASICS SYNTAX, ERRORS, AND DEBUGGING. GCOC – A.P. Computer Science A College Board Computer Science A Topics Covered Program Design - Read and understand.
Chapter 2: Your First Program! Hello World: Let’s Program  All programs must have the extension.java  Our first program will be named: HelloWorld.java.
Week 1 - Wednesday.  What did we talk about last time?  Syllabus  Computers.
1 Java Basics. 2 Compiling A “compiler” is a program that translates from one language to another Typically from easy-to-read to fast-to-run e.g. from.
Lecturer: Fintan Costello Welcome to Hdip 001 Introduction to Programming.
Java Intro. A First Java Program //The Hello, World! program in Java public class Hello { public static void main(String[] args) { System.out.println("Hello,
Outline Java program structure Basic program elements
1 Programming & Programming Languages Overview l Machine operations and machine language. l Example of machine language. l Different types of processor.
1 Programming & Programming Languages Overview l Machine operations and machine language. l Example of machine language. l Different types of processor.
COMP 14: Intro. to Intro. to Programming May 23, 2000 Nick Vallidis.
CS107 Introduction to Computer Science Java Basics.
Copyright 2013 by Pearson Education Building Java Programs Chapter 1 Lecture 1-1: Introduction; Basic Java Programs reading:
Getting Started with Java
“Introduction to Programming With Java”
Introducing Java.
Chapter 2 How to Compile and Execute a Simple Program.
 Java Programming Environment  Creating Simple Java Application  Lexical Issues  Java Class Library.
COMP 110: Introduction to Programming Tyler Johnson January 14, 2009 MWF 11:00AM-12:15PM Sitterson 014.
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
CS 106 Introduction to Computer Science I 01 / 25 / 2010 Instructor: Michael Eckmann.
CS107 Introduction to Computer Science Java Basics.
Introduction to Java Thanks to Dan Lunney (SHS). Java Basics File names The “main” method Output to screen Escape Sequence – Special Characters format()
Chapter 1 CSIS-120: Java Intro. What is Programming?  A: It is what makes computer so useful.  The flexibility of a computer is amazing  Write a term.
FRST JAVA PROGRAM. Getting Started with Java Programming A Simple Java Application Compiling Programs Executing Applications.
Intro and Review Welcome to Java. Introduction Java application programming Use tools from the JDK to compile and run programs. Videos at
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Board Activity Find your seat on the seating chart Login – Remember your login is your first initial your last name and the last three numbers of your.
CHAPTER 3 GC Java Fundamentals. 2 BASICS OF JAVA ENVIRONMENT  The environment  The language  Java applications programming Interface API  Various.
Object Oriented Programming Lecture 3. Introduction  In discussing Java, some items need to be clarified  The Java programming language  The Java virtual.
A First Simple Program /* This is a simple Java program. Call this file "Example.java".*/ class Example { // Your program begins with a call to main().
Output in Java Hello World!. Structure of a Java Program  All Java files in ICS3U1 have the following structure: class HelloWorld { }  Notice the open.
Introduction to programming in the Java programming language.
JAVA Practical Creating our first program 2. Source code file 3. Class file 4. Understanding the different parts of our program 5. Escape characters.
1 WELCOME TO CIS 1068! Instructor: Alexander Yates.
Anatomy of a Java Program. AnotherQuote.java 1 /** A basic java program 2 * 3 Nancy Harris, James Madison University 4 V1 6/2010.
A compiler is a computer program that translate written code (source code) into another computer language Associated with high level languages A well.
CSc 201 Introduction to Java George Wells Room 007, Hamilton Building
CS 106 Introduction to Computer Science I 01 / 22 / 2007 Instructor: Michael Eckmann.
introductory lecture on java programming
Agenda Comments Identifiers Keywords Syntax and Symentics Indentation Variables Datatype Operator.
The single most important skill for a computer programmer is problem solving Problem solving means the ability to formulate problems, think creatively.
Lecture1 Instructor: Amal Hussain ALshardy. Introduce students to the basics of writing software programs including variables, types, arrays, control.
Introducing Java Chapter 3 Review. Why Program in Java? Java, is an object-oriented programming language. OOP languages evolved out of the need to better.
Computer Science A 1. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated editor,
CS 177 Recitation Week 1 – Intro to Java. Questions?
ITP 109 Week 2 Trina Gregory Introduction to Java.
Chapter 3 Introducing Java. Objectives and Goals 1. Define terminology associated with object- oriented programming. 2. Explain why Java is a widely used.
Copyright 2010 by Pearson Education APCS Building Java Programs Chapter 1 Lecture 1-1: Introduction; Basic Java Programs reading:
Week 4 - Friday.  What did we talk about last time?  Examples  switch statements.
Introducing Java Chapter 3. Why Program in Java? 0 Java was developed by Sun Microsystems. It is a widely used high-level programming language. 0 One.
Lecture 3: Scaffolding and Output Announcements & Review Announcements Discussion Sections: PAI 5.70 until further notice Pair in same discussion
Introduction to programming in java
Week 1 - Wednesday CS 121.
Console Output, Variables, Literals, and Introduction to Type
CSE 190D, Winter 2013 Building Java Programs Chapter 1
Intro to Java.
Introduction to Java Dept. Business Computing University of Winnipeg
String Output ICS 111: Introduction to Computer Science I
Chapter 3 Classes and Objects
Fundamentals of Programming
Java Intro.
A Java Application public class Hello { public static void main(String [] args) { System.out.println("Hello, World!"); } } public class.
A Java Application public class Hello { public static void main(String [] args) { System.out.println("Hello, World!"); } } public class.
CSE 142, Spring 2012 Building Java Programs Chapter 1
Computer Programming-1 CSC 111
Week 1 - Friday COMP 1600.
Presentation transcript:

Week 1 - Friday

 What did we talk about last time?  Our first Java program

 The full Hello World program  Remember that everything is in a class  The class name must match the file name ( Hello.java )  The main() method is where the program starts  The print statement outputs information on the screen public class Hello { public static void main(String[] args) { System.out.println("Hello, world!"); } public class Hello { public static void main(String[] args) { System.out.println("Hello, world!"); }

 In Java, like C, C++, and many other languages, we separate different statements with a semicolon ( ; )  If we want to do a number of statements, we just type them in order, with a semicolon after each one

 For example, instead of one print statement, we can have several:  Each statement is an instruction to the computer  They are printed in order, one by one System.out.println("Hello, world!"); System.out.println("Hello, galaxy!"); System.out.println("Goodbye, world!"); System.out.println("Hello, world!"); System.out.println("Hello, galaxy!"); System.out.println("Goodbye, world!");

 Java is a case sensitive language  Class is not the same as class  System.out.println("Word!"); prints correctly  system.Out.Println("Word!"); does not compile

 Java generally ignores whitespace (tabs, newlines, and spaces) is the same as:  You should use whitespace effectively to make your code readable System.out.println("Hello, world!"); System.out. println( "Hello, world!"); System.out. println( "Hello, world!");

 Programs can be confusing  Sometimes you want to leave notes for yourself or anyone else who is reading your code  The standard way to do this is by using comments  Although comments appear in the code, they do not affect the final program

 There are two kinds of comments (actually 3)  Single line comments use //  Multi-line comments start with a /* and end with a */ System.out.println("Hi!"); // this is a comment System.out.println("Hi!"); /* this is a multi-line comment */ System.out.println("Hi!"); /* this is a multi-line comment */

 Java is a large, complex language  Even so, there are only a few tasks that you can ask it to do  You have already learned:  Sequencing  Basic output

 There are not that many other things you can tell Java to do 1. Storing numbers and text 2. Basic mathematical operations 3. Choosing between several options 4. Doing a task repetitively 5. Storing lists of things 6. More complicated input and output 7. Naming a task so that you can use it over and over again  That’s basically it

 The process of giving computers very detailed instructions about what to do  How do we do that exactly?  First, we need a programming language like Java  How do we turn a set of instructions written so that a human can read them into a set of instructions that a computer can read?  Magic, of course!

 There are many different programming languages:  Java  C/C++  ML  …thousands more  Each has different advantages in different situations

 We classify languages as high or low level  High level languages allow you to give more abstract commands that are more like human thought processes or mathematics  Low level languages are closer to the computer world and give explicit instructions for the hardware to follow MLJavaC++C Assembly Language Machine Code LowHigh

 We use a program called a compiler to turn a high level language into a low level language  Usually, the low level language is machine code  With, Java it's a little more complex

Computer! Solve a problem; Compile Execute Source Code Machine Code Hardware

 Java is a more complicated  Java runs on a virtual machine, called the JVM  Java is compiled to an intermediate stage called bytecode, which is platform independent  Then, the JVM runs a just-in-time compiler whenever you run a Java program, to turn the bytecode into platform dependent machine code

class A { Problem p; p.solve(); } Compile JVM Execute Java Source Code Machine Code Hardware Java Bytecode

1. Write a program in Java 2. Compile the program into bytecode 3. Run the bytecode using the JVM (which automatically compiles the bytecode to machine code)

Often goes through phases similar to the following: 1. Understand the problem 2. Plan a solution to the problem 3. Implement the solution in a programming language 4. Test the solution 5. Maintain the solution and do bug fixes Factor of 10 rule!

 We'll talk about data representation

 Read Chapter 3