Dasar-Dasar Pemrograman 2: Java Basics

Slides:



Advertisements
Similar presentations
CS0007: Introduction to Computer Programming Console Output, Variables, Literals, and Introduction to Type.
Advertisements

CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib.
Slides prepared by Rose Williams, Binghamton University Chapter 1 Getting Started 1.1 Introduction to Java.
Chapter 16 Programming and Languages: Telling the Computer What to Do.
Lecture 2: Do you speak Java?. From Problem to Program Last Lecture we looked at modeling with objects! Steps to solving a business problem –Investigate.
9-Aug-15 Vocabulary. Programming Vocabulary Watch closely, you might even want to take some notes. There’s a short quiz at the end of this presentation!
Computer Science 101 Introduction to Programming.
Introduction to Programming G50PRO University of Nottingham Unit 1 : Introduction Paul Tennent
Introducing Java.
Programming Translators.
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
1 Chapter 2 First Java Programs Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
PhD, Senior Lecturer, Baimuratov Olimzhon A LGORITHMS & P ROGRAMMING (P YTHON ) Lecture 1 From SDU:
Chapter 3: Completing the Problem- Solving Process and Getting Started with C++ Introduction to Programming with C++ Fourth Edition.
Chapter 1 Introduction. Goal to learn about computers and programming to compile and run your first Java program to recognize compile-time and run-time.
Computer Programming A program is a set of instructions a computer follows in order to perform a task. solve a problem Collectively, these instructions.
Computer Programming TCP1224 Chapter 3 Completing the Problem-Solving Process and Getting Started with C++
Python – Part 1 Python Programming Language 1. What is Python? High-level language Interpreted – easy to test and use interactively Object-oriented Open-source.
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Week 1 - Friday.  What did we talk about last time?  Our first Java program.
Python From the book “Think Python”
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
1 Problem Solving with C++ The Object of Programming Walter Savitch Chapter 1 Introduction to Computers and C++ Programming Slides by David B. Teague,
Chapter 1 Section 1.1 Introduction to Java Slides prepared by Rose Williams, Binghamton University Kenrick Mock, University of Alaska Anchorage.
Chapter 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
© 2004 Pearson Addison-Wesley. All rights reserved ComS 207: Programming I Instructor: Alexander Stoytchev
I Power Higher Computing Software Development Development Languages and Environments.
JavaScript Defined JavaScript Basics Definitions JavaScript is an object-oriented programming language designed for the world wide web. JavaScript code.
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
A compiler is a computer program that translate written code (source code) into another computer language Associated with high level languages A well.
Chapter 4 Software. Chapter 4: Software Generations of Languages Each computer is wired to perform certain operations in response to an instruction. An.
How to Program? -- Part 1 Part 1: Problem Solving –Analyze a problem –Decide what steps need to be taken to solve it. –Take into consideration any special.
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
Introduction to OOP CPS235: Introduction.
Getting Started With Java September 22, Java Bytecode  Bytecode : is a highly optimized set of instructions designed to be executed by the Java.
The single most important skill for a computer programmer is problem solving Problem solving means the ability to formulate problems, think creatively.
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.
Compilers and Interpreters
Review A program is… a set of instructions that tell a computer what to do. Programs can also be called… software. Hardware refers to… the physical components.
CHAPTER 3 COMPLETING THE PROBLEM- SOLVING PROCESS AND GETTING STARTED WITH C++ An Introduction to Programming with C++ Fifth Edition.
Unit 1 Review By: Mr. Jacobs.
Intro. to Computer Programming Eng. Nehal A. Mohamed Spring Semester-2016.
Software Engineering Algorithms, Compilers, & Lifecycle.
Computer Systems Nat 5 Computing Science
Dept of Computer Science University of Maryland College Park
Visit for more Learning Resources
Chapter 1: Introduction to computers and C++ Programming
Programming Language Hierarchy, Phases of a Java Program
Key Ideas from day 1 slides
Computer Systems Nat 5 Computing Science
Revision Lecture
Data types and variables
Chapter 2 First Java Programs
Introduction Java Chapter 3.
Chapter 10 Programming Fundamentals with JavaScript
High Level Programming Languages
A programming language
PROGRAMMING FUNDAMENTALS Lecture # 03. Programming Language A Programming language used to write computer programs. Its mean of communication between.
Tonga Institute of Higher Education IT 141: Information Systems
Tonga Institute of Higher Education IT 141: Information Systems
Basic Programming Concepts
1.3.7 High- and low-level languages and their translators
WJEC GCSE Computer Science
Dasar-Dasar Pemrograman 2: Generics
Instructor: Alexander Stoytchev
Dasar-Dasar Pemrograman 2: Java Conditions and Loops
Programming for Business Computing Introduction
Presentation transcript:

Dasar-Dasar Pemrograman 2: Java Basics Fariz Darari (fariz@cs.ui.ac.id) Credit: https://www.pexels.com/@negativespace Feel free to use, reuse, and share this work: the more we share, the more we have!

Problem solving The single most important skill for a computer scientist is problem solving. It's the ability to: formulate problems, think creatively about solutions, and express solutions clearly and accurately. As it turns out, the process of learning to program is an excellent opportunity to develop problem solving skills.

Compiling and running a Java program Java is both compiled and interpreted. Instead of translating programs directly into machine language, the Java compiler generates byte code. Similar to machine language, byte code is easy and fast to interpret. But it is also portable, so it is possible to compile a Java program on one machine, transfer the byte code to another machine, and run the byte code on the other machine. The interpreter that runs byte code is called a "Java Virtual Machine" (JVM).

Hello, World!

Escape sequences

Escape sequences

We could write something like this, but..

We could write something like this, but.. This one reads better :)

Quiz time What is a program? What is a bug? What is compile?

Quiz time What is a program? What is a bug? An error in a program. A sequence of instructions that specifies how to perform tasks on a computer. What is a bug? An error in a program. What is compile? To translate a program in a high-level language into a low-level language, all at once, in preparation for later execution.

Variables A variable is a named location that stores a value. Values may be numbers, text, images, sounds, and other types of data.

Declaration Assignment

Declare and assign variables on same line

Printing variables

Arithmetic operators

Floating-point numbers

Error types Compile-time error Compile-time errors occur when you violate the syntax rules of the Java language. For example, parentheses and braces have to come in matching pairs. So (1 + 2) is legal, but 8) is not. Runtime error The second type of error is a run-time error, so-called because it does not appear until after the program has started running. Logic error If your program has a logic error, it will compile and run without generating error messages, but it will not do the right thing.

Picture: https://unsplash.com/photos/VyC0YSFRDTU Credits: Chapter 1 and 2 of Think Java book by Allen Downey and Chris Mayfield