“Hello World” In Java Mehdi Einali Advanced Programming in Java 1.

Slides:



Advertisements
Similar presentations
Programming TBE 540 Farah Fisher. Objectives After viewing this presentation, the learner will be able to… Given a task, create pseudocode Given pseudocode,
Advertisements

Debugging Introduction to Computing Science and Programming I.
Python Programming Chapter 1: The way of the program Saad Bani Mohammad Department of Computer Science Al al-Bayt University 1 st 2011/2012.
General Computer Science for Engineers CISC 106 Lecture 21 Dr. John Cavazos Computer and Information Sciences 04/10/2009.
XP 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial 10.
1 Chapter 2 Introductory Programs. 2 Getting started To create and run a Java program –Create a text file with a.java extension for the source code. For.
Java Review 2 – Errors, Exceptions, Debugging Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Copyright 2008 by Pearson Education 1 Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading:
Chapter 1 - Introduction. Ch 1Goals To understand the activity of programming To learn about the architecture of computers To learn about machine code.
Sadegh Aliakbary. Copyright ©2014 JAVACUP.IRJAVACUP.IR All rights reserved. Redistribution of JAVACUP contents is not prohibited if JAVACUP.
Sadegh Aliakbary Sharif University of Technology Fall 2012.
1 I.Introduction to Algorithm and Programming Algoritma dan Pemrograman – Teknik Informatika UK Petra 2009.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Java Programs COMP 102 #3.
Sadegh Aliakbary Sharif University of Technology Spring 2011.
Sadegh Aliakbary. Copyright ©2014 JAVACUP.IRJAVACUP.IR All rights reserved. Redistribution of JAVACUP contents is not prohibited if JAVACUP.
Sadegh Aliakbary Sharif University of Technology Fall 2010.
DAT602 Database Application Development Lecture 5 JAVA Review.
EGR 2261 Unit 5 Control Structures II: Repetition  Read Malik, Chapter 5.  Homework #5 and Lab #5 due next week.  Quiz next week.
©Xiaoying Gao, Peter Andreae First Java Program COMP 102 #2 2014T2 Xiaoying Sharon Gao Computer Science Victoria University of Wellington.
PYTHON. Python is a high-level, interpreted, interactive and object- oriented scripting language. Python was designed to be highly readable which uses.
First Java Program COMP 102 #2 2015T2 Xiaoying Sharon Gao Computer Science Victoria University of Wellington.
Sadegh Aliakbary Sharif University of Technology Fall 2012.
Advanced Programming Collage of Information Technology University of Palestine, Gaza Prepared by: Mahmoud Rafeek Alfarra Lecture 2: Major Concepts of Programming.
Python – Part 1 Python Programming Language 1. What is Python? High-level language Interpreted – easy to test and use interactively Object-oriented Open-source.
CS 11 java track: lecture 1 Administrivia need a CS cluster account cgi-bin/sysadmin/account_request.cgi need to know UNIX
Basics of Java IMPORTANT: Read Chap 1-6 of How to think like a… Lecture 3.
 JAVA Compilation and Interpretation  JAVA Platform Independence  Building First JAVA Program  Escapes Sequences  Display text with printf  Data.
King Fahd University of Petroleum & Minerals College of Computer Science & Engineering Information & Computer Science Department Lecture 1 : Introduction.
PHP Logic. Review: Variables Variables: a symbol or name that stands for a value – Data types ( Similar to C++ or Java): Int, Float, Boolean, String,
Peyman Dodangeh Sharif University of Technology Spring 2014.
ALBERT WAVERING BOBBY SENG. Week 4: JavaScript  Quiz  Announcements/questions.
Copyright 2008 by Pearson Education 1 Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading:
1 Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Pascal Programming Pascal Loops and Debugging. Pascal Programming Pascal Loops In our first brush with the while do loops, simple comparisons were used.
Copyright 2010 by Pearson Education 1 Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading:
School of Computer Science & Information Technology G6DICP - Lecture 6 Errors, bugs and debugging.
Introduction Mehdi Einali Advanced Programming in Java 1.
“Hello World” In Java Mehdi Einali Advanced Programming in Java 1.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Java Programs COMP 102 #3.
Error Handling Tonga Institute of Higher Education.
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.
Mid-Year Review. Coding Problems In general, solve the coding problems by doing it piece by piece. Makes it easier to think about Break parts of code.
© Peter Andreae Java Programs COMP 102 # T1 Peter Andreae Computer Science Victoria University of Wellington.
Today’s Agenda ML Development Workflow –Emacs –Using use –The REPL More ML –Shadowing Variables –Debugging Tips –Boolean Operations –Comparison Operations.
Learning Javascript From Mr Saem
CPSC 233 Tutorial January 21 st /22 nd, Linux Commands.
IST 210: PHP Logic IST 210: Organization of Data IST2101.
Last week: We talked about: History of C Compiler for C programming
Lecture 2 D&D Chapter 2 & Intro to Eclipse IDE Date.
COMPUTATIONAL CONSTRUCTS
GC101 Introduction to computer and program
Testing and Debugging.
Chapter 2 Assignment and Interactive Input
Programming Mehdi Bukhari.
CS180 – Week 1 Lecture 3: Foundation Ismail abumuhfouz.
Primitive Data, Variables, Loops (Maybe)
Advanced Programming in Java
Cracking the Coding Interview
Advanced Programming Fall 2017.
Testing, debugging, and using support libraries
Building Java Programs
ICT Programming Lesson 4:
Advanced Programming Behnam Hatami Fall 2017.
Homework Applied for cs240? (If not, keep at it!) 8/10 Done with HW1?
Advanced Programming in Java
Chapter 2 Programming Basics.
A LESSON IN LOOPING What is a loop?
Building Java Programs
Building Java Programs
Presentation transcript:

“Hello World” In Java Mehdi Einali Advanced Programming in Java 1

2 Agenda Review First program in java Variables Methods Conditions Loops

3 Review Java is Simple object oriented And popular Java is platform independent. Write Once, Run Anywhere!

4 Hello World Create a file named First.java Java class files have.java extension Note to naming convention Copy this lines to the file Note: File name and class name should be the same.

5

6 Debugging Syntax Error Run-time errors exceptions logic or semantic error The semantics, or meaning of the program, are wrong

7 Java Programs A simple java program is a file The file contains one class The class name equal to the file name The names are case sensitive The class contains a main method When we run the program, the main method is executed

8 Variables What is a variable? A piece of memory Holds data For example a number, string or Boolean Java variables have a fixed size Platform independence

9 Java Primitive Types

10 Arithmetic Operators

11 Operator Precedence * 3 = ? is treated as 1 + (2 * 3)

12 Equality and Relational Operators

13 Operators

14 Exercise

15 Programming strategy Incremental Development Start with a working program that does something visible, like printing something. Add a small number of lines of code at a time, and test the program after every change. Repeat until the program does what it is supposed to do

16 Recipe For Failure -1 Non-incremental development If you write more than a few lines of code without compiling and testing, you are asking for trouble Attachment to bad code If you write more than a few lines of code without compiling and testing, you may not be able to debug it

17 Recipe For Failure -2 Random-walk programming Make a change, run the program, get an error, make a change, run the program, etc he problem is that there is no apparent connection between the outcome of the program and the change. Compiler submission Error messages are useful, but they are not always right. Please think before edit

18 Khokhan-1

19 Khokhan-2 Stubborn Crazy Untidy Stochastic Hate other khokhans And Love Chaos

20 end