Getting Started.

Slides:



Advertisements
Similar presentations
IT151: Introduction to Programming
Advertisements

1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
Your First Java Program: HelloWorld.java
CMT Programming Software Applications
Slide 1 of 40. Lecture A The Java Programming Language Invented 1995 by James Gosling at Sun Microsystems. Based on previous languages: C, C++, Objective-C,
Tutorial 1 Introduction to Java Programming Bo Chen Department of Computer Science.
Copyright 2013 by Pearson Education Building Java Programs Chapter 1 Lecture 1-1: Introduction; Basic Java Programs reading:
Copyright 2008 by Pearson Education Building Java Programs Chapter 1 Lecture 1-1: Introduction; Basic Java Programs reading: self-check: #1-14.
“Introduction to Programming With Java”
Introducing Java.
Towson University COSC 236
2.2 Information on Program Appearance and Printing.
Introduction to Programming Prof. Rommel Anthony Palomino Department of Computer Science and Information Technology Spring 2011.
CompSci 42.1Intro to Java Anatomy of a Class & Terminology Running and Modifying a Program.
Welcome to the Lecture Series on “Introduction to Programming With Java”
Introduction to Java Thanks to Dan Lunney (SHS). Java Basics File names The “main” method Output to screen Escape Sequence – Special Characters format()
Session One Introduction. Personal Introduction Role of programmers Robot Examination HUD & HID Uploading Code.
The string data type String. String (in general) A string is a sequence of characters enclosed between the double quotes "..." Example: Each character.
Introduction to Programming David Goldschmidt, Ph.D. Computer Science The College of Saint Rose Java Fundamentals (Comments, Variables, etc.)
CS 11 java track: lecture 1 Administrivia need a CS cluster account cgi-bin/sysadmin/account_request.cgi need to know UNIX
Intro and Review Welcome to Java. Introduction Java application programming Use tools from the JDK to compile and run programs. Videos at
CHAPTER 3 GC Java Fundamentals. 2 BASICS OF JAVA ENVIRONMENT  The environment  The language  Java applications programming Interface API  Various.
Chapter 2: Java Fundamentals
FIRST JAVA PROGRAM. JAVA PROGRAMS Every program may consist of 1 or more classes. Syntax of a class: Each class can contain 1 or more methods. public.
Output in Java Hello World!. Structure of a Java Program  All Java files in ICS3U1 have the following structure: class HelloWorld { }  Notice the open.
Can we talk?. In Hello World we already saw how to do Standard Output. You simply use the command line System.out.println(“text”); There are different.
National Taiwan University Department of Computer Science and Information Engineering National Taiwan University Department of Computer Science and Information.
4-Nov-15 Air Force Institute of Technology Electrical and Computer Engineering Object-Oriented Programming Design Topic 1: The Java Environment Maj Joel.
EIE375 BlueJ: Getting Started Dr Lawrence Cheung.
JAVA Practical Creating our first program 2. Source code file 3. Class file 4. Understanding the different parts of our program 5. Escape characters.
ECE 122 Feb. 1, Introduction to Eclipse Java Statements Declaration Assignment Method calls.
Chapter 3 Introduction To Java. OBJECTIVES Packages & Libraries Statements Comments Bytecode, compiler, interpreter Outputting print() & println() Formatting.
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.
Hello Computer Science!. Below is an example of a Hello World program in JAVA. While it is only three lines of code, there are many things that are happening.
Chapter 2 topics Concept # on Java Subset Required for AP Exam print and println10. Testing of output is restricted to System.out.print and System.out.println.
Lab 01-2 Objectives:  Writing a Java program.  How to send output to the command line console.  Learn about escape sequences.  Learn how to compile,
A Simple Java Program //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) { public static void main(String[]
introductory lecture on java programming
Agenda Comments Identifiers Keywords Syntax and Symentics Indentation Variables Datatype Operator.
Chapter 2 print / println String Literals Escape Characters Variables / data types.
CSCI 1100/1202 January 14, Abstraction An abstraction hides (or ignores) the right details at the right time An object is abstract in that we don't.
Chapter 2 1.What is the difference between print / println 2.What are String Literals 3.What are the Escape Characters for backslash, double quotataions,
CS 177 Recitation Week 1 – Intro to Java. Questions?
1/16: Intro to Java, Languages, and Environments Types of programming languages –machine languages –assembly languages –high-level languages Java environment.
CS 106 Introduction to Computer Science I 01 / 24 / 2007 Instructor: Michael Eckmann.
8/2/07. >>> About Me Scott Shawcroft * Junior * Computer Engineering * Third Quarter TA * Creative Commons Intern * Small-time Open Source Developer
Computer Science I Lab 1 ISMAIL ABUMUHFOUZ | CS 180.
Welcome to CSE 142! Zorah Fung University of Washington, Summer Building Java Programs Chapter 1 Lecture 1-1: Introduction; Basic Java Programs.
Programs and Models Almost all computer programs model some artifact – Artifact: product of civilization, either concrete or abstract, simple or complex.
Copyright 2010 by Pearson Education APCS Building Java Programs Chapter 1 Lecture 1-1: Introduction; Basic Java Programs reading:
Zorah Fung University of Washington, Winter 2016
Introduction to programming in java
Computer Programming Your First Java Program: HelloWorld.java.
CSE 190D, Winter 2013 Building Java Programs Chapter 1
CompSci 230 Software Construction
Intro to Java.
Statements, Comments & Simple Arithmetic
Java Intro.
Chapter 2 Create a Chapter 2 Workspace Create a Project called Notes
Advanced Programming CS206
Welcome to CSE 142!.
Building Java Programs
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
CSE 142, Winter 2014 Building Java Programs Chapter 1
JAVA. Java is a high-level programming language originally developed by Sun Microsystems and released in Java runs on a variety of platforms, such.
How to Run a Java Program
Presentation transcript:

Getting Started

Our Java Programming Environment: DrJava Home Page: http://drjava.org DrJava requires Java 2, version 1.4 or later. It is recommended to download and use Sun's JDK 1.5.0, currently in beta releases, (from http://java.sun.com)

Starting to Program in Java /* & */ surround a >commented= area - this part of the program is NOT run, but is for some else to understand what you did /* Name Assignment Number Date Description in your own words of what the assignment does */ LIBRARY / PACKAGE attachment ... this allows the use of commands found in within the >attached= packages - java.awt.* for standard Java commands import java.awt.*;

Your First Java Program Comment line. Any line that starts with // is a comment line. // The "HelloWorld" class. public class HelloWorld { public static void main (String[] args) { System.out.println("Hello World!"); } // main method } // HelloWorld class Defines the class name. The class name must agree with the file name, this class must be saved as HelloWorld.java. It must match exactly as Java is case sensitive Defines the start of the class. void -> means the method does not return a value. static -> loads the method into memory and keeps it there. public -> means that other classes can call this method. main -> is the method name, this is the name used for the method that starts the program. String [] args - allows for use of words / Strings { } surrounds all parts of the main block Instructs the program to print "Hello World!" ... all programming code in the main block Defines the end of the class.

Printing Techniques To print a blank line, we can simply write: System.out.println(); To print a VERY LONG LINE, we write the following: System.out.println(“This will print a Verrrrrrrrry long” + “on one line by joining” + “these strings into one line”); The process of joining strings is called (+ Sign) Concatenation

If we don’t wish to jump to a new line after printing a string, we can use the method instead of Println print System.out.print(“Hello”); System.out.print(“There!”); This will produce: HelloThere! If we Want to print a string that contains escape sequences such as double quotes, backslash, java ‘s solution is to use Immediately infront of the escape sequence. \ System.out.println(“A double quote: \””); System.out.println(“A backslash: \\”); This will produce: A double quote: ” A backslash: \

Assignment #1 P. 12 # 5, 6, 7 Due Friday 7th, 2008

Assignment # 1 Rubric