JAVA JAVA is an object-oriented programming (OOP) language introduced by Sun Microsystems in 1995. In the Java programming language: A program is made.

Slides:



Advertisements
Similar presentations
CSCI 160 Midterm Review Rasanjalee DM.
Advertisements

Chapter 1: Computer Systems
Classes  All code in a Java program is part of a class  A class has two purposes  Provide functions to do work for the programmer  Represent data.
Dale Roberts Introduction to Java - First Program Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and.
Chapter 1: Introduction
1 Kursusform  13 uger med: Undervisning i klassen 1,5-2 timer Opgave ”regning” i databar (løsninger på hjemmeside) En midtvejsopgave der afleveres og.
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.
The Java Programming Language
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
Primitive Data Types byte, short, int, long float, double char boolean Are all primitive data types. Primitive data types always start with a small letter.
Fundamental Programming Structures in Java: Comments, Data Types, Variables, Assignments, Operators.
Chapter 1 Introduction. © 2004 Pearson Addison-Wesley. All rights reserved1-2 Outline Computer Processing Hardware Components Networks The Java Programming.
Chapter 1 Introduction.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
CH1 – A 1 st Program Using C#. Program Set of instructions which tell a computer what to do. Machine Language Basic language computers use to control.
Introducing Java.
Chapter 1 Introduction.
HOW COMPUTERS MANIPULATE DATA Chapter 1 Coming up: Analog vs. Digital.
LESSON 2 CREATING A JAVA APPLICATION JAVA PROGRAMMING Compiled By: Edwin O. Okech [Tutor, Amoud University]
© 2006 Pearson Education Computer Systems Presentation slides for Java Software Solutions for AP* Computer Science A 2nd Edition.
Chapter 1.4 Programming languages Homework Due: Monday, August 11, 2014.
Java Language and SW Dev’t
CS107 Introduction to Computer Science Java Basics.
Chapter 1 Introduction to Java 10/8/2015 Lecture 1 1.
Session One Introduction. Personal Introduction Role of programmers Robot Examination HUD & HID Uploading Code.
© 2006 Pearson Education 1 Obj: cont 1.3 and 1.4, to become familiar with identifiers and to understand how programming languages work HW: p.51 #1.8 –
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
1 Computer Systems -- Introduction  Chapter 1 focuses on:  the structure of a Java application  basic program elements  preparing and executing a program.
CSCE 2013L: Lab 1 Overview  Java Basics The JVM Anatomy of a Java Program  Object-Oriented Programming Overview  Example: Payroll.java JDK Tools and.
The Java Programming Language
Introduction. Objectives An overview of object-oriented concepts. Programming and programming languages An introduction to Java 1-2.
Object Oriented Programming … and other things you need to program in java.
Lecture :2 1.  DEFENTION : Java is a programming language expressly designed for use in the distributed environment of the Internet. It was designed.
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.
Java means Coffee Java Coffee Beans The name “JAVA” was taken from a cup of coffee.
CS591x A very brief introduction to Java. Java Developed by Sun Microsystems was intended a language for embedded applications became a general purpose.
CHAPTER 3 GC Java Fundamentals. 2 BASICS OF JAVA ENVIRONMENT  The environment  The language  Java applications programming Interface API  Various.
CIT 590 Intro to Programming First lecture on Java.
Lecture 1 Introduction Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
Methods F Hello World! F Java program compilation F Introducing Methods F Declaring Methods F Calling Methods F Passing Parameters by value F Overloading.
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.
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().
BUILDING JAVA PROGRAMS CHAPTER 1 ERRORS. 22 OBJECTIVES Recognize different errors that Java uses and how to fix them.
Chapter 1: Introduction Java Programming Language How the Java Virtual Machine Works (compiling, etc…) Update by: Dan Fleck Coming up: The Java Programming.
Java The Java programming language was created by Sun Microsystems, Inc. It was introduced in 1995 and it's popularity has grown quickly since A programming.
© 2004 Pearson Addison-Wesley. All rights reserved ComS 207: Programming I Instructor: Alexander Stoytchev
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Intro to Programming  Chapter 1 Part 2  Problem Solving.
Java FilesOops - Mistake Java lingoSyntax
© 2011 Pearson Education, publishing as Addison-Wesley Chapter 1: Computer Systems Presentation slides for Java Software Solutions for AP* Computer Science.
Java Programming Fifth Edition Chapter 1 Creating Your First Java Classes.
Introduction to 1. What is Java ? Sun Microsystems Java is a programming language and computing platform first released by Sun Microsystems in The.
Chapter 1 Object Orientation: Objects and Classes.
Introduction to Java Programming by Laurie Murphy Revised 09/08/2016.
1 Problem Solving  The purpose of writing a program is to solve a problem  The general steps in problem solving are: Understand the problem Dissect the.
Working with Java.
GC101 Introduction to computer and program
Chapter 3 GC 101 Java Fundamentals.
Introduction to.
Intro to Java.
Chapter 1: Computer Systems
Java Intro.
Units with – James tedder
Chap 1 Chap 2 Chap 3 Chap 5 Surprise Me
Anatomy of a Java Program
Fundamental OOP Programming Structures in Java: Comments, Data Types, Variables, Assignments, Operators.
In this class, we will cover:
Instructor: Alexander Stoytchev
Presentation transcript:

JAVA JAVA is an object-oriented programming (OOP) language introduced by Sun Microsystems in In the Java programming language: A program is made up of one or more classes A class contains one or more methods A method contains program statements

JAVA Class with a method: class name public class MyClass //class header { private int myInt = 5; //instance variable public double myMethod(int intParam) //method header { // do stuff here }

Class with a method: public class myClass variable name initial value { type private int myInt = 5; //instance variable public double myMethod(int intParam) { // do stuff here } JAVA

Class with a method: public class myClass { private int myInt = 5; //instance variable return type name parameter type public double myMethod(int intParam) { // do stuff here parameter name return myVar; //return statement } JAVA

Java comments: Used to explain code. Ignored by the compiler //single line comment. /* multiple line comment */ /**This is a javadoc comment*/

JAVA The words used to program in Java (or any other language) are called identifiers. Java identifiers can be made of letters digits or the underscore character. They can not start with a number: You should use JAVA conventions in naming your identifiers: Class names begin with a capital letter: MyClass Variable names begin with a lower case letter: myInteger Methods begin with a lower case letter: myMethod Constants are all caps: MAXIMUM

JAVA Many languages compile to run on a specific machine. The Java compiles the code to Java bytecode. A java interpreter installed on the machine running the program converts the Java bytecode to the machines native code. This lets a program written in Java run on multiple platforms. For instance a program compiled on a Linux machine can be run on a Microsoft machine. Java is considered to be architecture-neutral. Java source code Machine code Java bytecode Java interpreter Java compiler

(x, y) JAVA Graphics in Java: Horizontal (x) coordinates are measured from right. Vertical (y) coordinates are measured from top. We are used to measuring vertical coordinates from the x-axis, so this can take some getting used to: (x, y)

JAVA Hello World! Public class Test { public static void main(String[] args) { System.out.println(“Hello World!”); }

JAVA Page 52: Programming Project 1.1 – 1.2 Page 48:1.13 – 1.17 self review Page 50: MC 1.6 – 1.8 Page 51: Short Answer 1.7 – 1.9

JAVA 1.13 What is the difference between a high level language and a machine Language? 1.14 What is JAVA bytecode? 1.15 What is whitespace. Does it change program execution Which of the following are not valid JAVA identifiers? a)RESULT b) result c) d) x12345y e) black&white f)answer_7 Page Why might the following valid JAVA identifiers not be good ones? a)q b) totVal c. theNextValueInTheList

Identify the following errors as compile-time, runtime, or logical: a)Multiplying two numbers when you meant to add them b)Dividing by zero c)Forgetting a semi-colon at the end of a statement d)Spelling a word wrong in the output. e)Producing inaccurate results f)Typing “{“ when you should have typed “(“