GC101 Introduction to computer and program

Slides:



Advertisements
Similar presentations
IT151: Introduction to Programming
Advertisements

Chapter 1 Introduction to JAVA. Why Learn JAVA? Java is one of the fastest growing programming language in the world. Java is one of the fastest growing.
 2005 Pearson Education, Inc. All rights reserved Introduction.
Chapter 1: Introduction
 2003 Prentice Hall, Inc. All rights reserved. Customized by Sana Odeh for the use of this class. 1 Introduction to Computers and Programming in JAVA.
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,
1. 2 Chapter 1 Introduction to Computers, Programs, and Java.
Liang, Introduction to Java Programming, Tenth Edition, (c) 2015 Pearson Education, Inc. All rights reserved. 1 Chapter 1 Introduction to Computers, Programs,
CSC 111 Java Programming I. Java Programming: From Problem Analysis to Program Design, Second Edition  Instructor – Salwa Hamad Al-Jasser  Office.
Chapter 1 Introduction to Computers, Programs, and Java
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to Computers,
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to Programs,
Introduction to Computers and Java Chapter 1.3. A Sip of Java: Outline History of the Java Language Applets A First Java Program Compiling a Java Program.
1.  At the end of this slide, student can:  Explore tools, features, properties and interface of the Textpad.  Creating a new project.  Open and run.
© 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 –
The Java Programming Language
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to.
Chapter 1 Introduction to Computers, Programs, and Java 1.
Chapter 1: Introduction to Programs, and Java 1. Objectives To review programs (§ ). To understand the relationship between Java and the World Wide.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to Programs.
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.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
CHAPTER 3 GC Java Fundamentals. 2 BASICS OF JAVA ENVIRONMENT  The environment  The language  Java applications programming Interface API  Various.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to.
J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Second Edition Second Edition D.S. Malik D.S. Malik.
Application Architecture Using Java Hong Li. Introduction Developed by a team led by James Gosling at Sun Microsystem. Originally called Oak, designed.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to.
Java FilesOops - Mistake Java lingoSyntax
Introduction to Java Programming. 2 Chapter 1 Introduction to Java and Forte F What Is Java? F Getting Started With Java Programming –Create, Compile.
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 1 Introduction to Computers, Programs,
Lecture1 Instructor: Amal Hussain ALshardy. Introduce students to the basics of writing software programs including variables, types, arrays, control.
1 CSE1340 Class 4. 2 Objectives Write a simple computer program in Java Use simple Output statements Understand the different types and uses of comments.
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 1 Introduction.
Java Programming Fifth Edition Chapter 1 Creating Your First Java Classes.
Introduction to Java Programming, 4E Y. Daniel Liang.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
Introduction to Object Oriented
Chapter 1 Introduction to Computers, Programs, and Java
Chapter 1 Introduction to Computers, Programs, and Java
Chapter 1: Introduction to Computers, Programs, and Java
Working with Java.
Chapter 1 Introduction to Computers, Programs, and Java
Chapter 1 Introduction to Computers, Programs, and Java
Chapter 1 Introduction to Computers, Programs, and Java
Chapter 1 Introduction to Computers, Programs, and Java
Chapter 3 GC 101 Java Fundamentals.
Lecture 1: Introduction to JAVA
Chapter 2 Elementary Programming
Data types and variables
Introduction to Programming
Java programming lecture one
Chapter 1 Introduction to Computers, Programs, and Java
Chapter 1 Introduction to Computers, Programs, and Java
Chapter 1 Introduction to Computers, Programs, and Java
Chapter 1 Introduction to Computers, Programs, and Java
Units with – James tedder
Units with – James tedder
Chapter 1 Introduction to Computers, Programs, and Java
Chapter 1 Introduction to Computers, Programs, and Java
elementary programming
Anatomy of a Java Program
Lecture Notes - Week 2 Lecture-1. Lecture Notes - Week 2 Lecture-1.
(Computer fundamental Lab)
Chapter 1 Introduction to Computers, Programs, and Java
Computer Programming-1 CSC 111
Outcome of the Lecture Upon completion of this lecture you will be able to understand Fundamentals and Characteristics of Java Language Basic Terminology.
Introduction to Computers, Programs, and Java
Presentation transcript:

GC101 Introduction to computer and program Lecture3 Sara Alhajjam

Why Java? One of the most popular programming languages in use. Java enables users to develop and deploy applications on the Internet for servers, desktop computers, and small hand-held devices. "write once, run anywhere": code that runs on one platform does not need to be recompiled to run on another. Java applications are typically compiled to bytecode (class file) that can run on any Java Virtual Machine (JVM).

Characteristics of Java Java is concurrent, class-based, object-oriented, and specifically designed to have as few implementation dependencies as possible. was originally developed by James Gosling at Sun Microsystems (which has since merged into Oracle Corporation). derives much of its syntax from C and C++.

Popular Java IDEs NetBeans https://netbeans.org/ Eclipse http://www.eclipse.org/ JCreator http://jcreator.com/

Processing a Java Program A Java program undergoes several stages : 1. Editing: use Java code and save in a text file named className .java ( source program ). 2. Compiling: the compiler checks the source program for any syntax errors then translates the program into code understood by interpreter called bytecode saved in a file named className.class 3. Loading: the .class file is loaded into computer main memory for execution, and connected to all classes. 4. Verifying: to validate and secure against damage . 5. Interpreting: the Interpreter reads and translates each bytecode instruction into machine language and then executes it , one instruction at a time .

Processing a Java Program

Anatomy of a Java Program Class name Main method Statements Statement terminator Reserved words Comments Blocks

Class Name Every Java program must have at least one class. Each class has a name. By convention, class names start with an uppercase letter. In the following example, the class name is Welcome: //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java!"); }

Main Method Line 2 defines the main method. In order to run a class, the class must contain a method named main. The program is executed from the main method. //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java!"); }

Statement A statement represents an action or a sequence of actions. The statement System.out.println("Welcome to Java!") in the program is a statement to display the greeting "Welcome to Java! ". //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java!"); }

Statement Terminator Every statement in Java ends with a semicolon (;). //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java!"); }

Reserved words Reserved words or keywords are words that have a specific meaning to the compiler and cannot be used for other purposes in the program. Example, when the compiler sees the word class, it understands that the word after class is the name for the class. //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java!"); }

Blocks A pair of braces in a program forms a block that groups components of a program.

Special Symbols

Programming Errors Syntax Errors Runtime Errors Logic Errors Detected by the compiler Runtime Errors Causes the program to abort Logic Errors Produces incorrect result

Syntax Errors public class ShowSyntaxErrors { public static main(String[] args) { System.out.println("Welcome to Java); }

Runtime Errors public class ShowRuntimeErrors { public static void main(String[] args) { System.out.println(1 / 0); }

Logic Errors public class ShowLogicErrors { public static void main(String[] args) { for (i=1; i<=10; i++) ; {    System.out.println("Number is " + i);  } }

Java Identifiers They are names that we introduce in our program public class Message { public static void main(String[] arg) System.out.println("This is a message"); } They are names that we introduce in our program The name of the class, variables, objects, and methods. Some are predefined; others are defined by the user. Consists of: Letters: (a  z) ( A  Z) Digits (0  9) The underscore character (_) Must begin with a letter, underscore, or the dollar sign. It cannot start with a digit. .

Java Identifiers Java identifiers can be any length. An identifier cannot be a reserved word. An identifier cannot be true, false, or null. Names should be descriptive: • Message – the name of a program that prints out a message. • System.out.println – the name for a part of Java that prints a line of output to the screen.

Illegal Identifiers